SSH client is a program for logging into a remote machine and for executing commands on a remote machine. By default in Linux/UNIX if particular command/shell script is executed, it return two type of values which is used to see whether command or shell script executed is successful or not. This value is know as Exit Status of shell command or script.
The session terminates when the command or shell on the remote machine exits and all X11 and TCP/IP connections have been closed. The exit status of the remote program is returned as the exit status of ssh. You can use bash shell $? Variable to print exit status of shell. For example:
user@localhost: $ ssh firstname.lastname@example.org
email@example.com: $ exit
user@localhost: $ echo $?
- ssh exits with the exit status of the remote command which can be find with echo $? command.
- Or value 255 is return, if an error occurred while processing request via ssh session
- 30 Handy Bash Shell Aliases For Linux / Unix / Mac OS X
- Top 30 Nmap Command Examples For Sys/Network Admins
- 25 PHP Security Best Practices For Sys Admins
- 20 Linux System Monitoring Tools Every SysAdmin Should Know
- 20 Linux Server Hardening Security Tips
- Linux: 20 Iptables Examples For New SysAdmins
- Top 20 OpenSSH Server Best Security Practices
- Top 20 Nginx WebServer Best Security Practices
- 20 Examples: Make Sure Unix / Linux Configuration Files Are Free From Syntax Errors
- 15 Greatest Open Source Terminal Applications Of 2012
- My 10 UNIX Command Line Mistakes
- Top 10 Open Source Web-Based Project Management Software
- Top 5 Email Client For Linux, Mac OS X, and Windows Users
- The Novice Guide To Buying A Linux Laptop