Managing Multiple Computers With SSH

Most of the time managing multiple computers at the same time over a low bandwidth connection feels like waiting for the midnight fireworks on new years eve when you started that bottle of champagne at 3:00pm is 9:00pm you go through two of them and just want the damn day to end. Anyways… sometimes the fastest way to manage running application on unix servers is just to SSH to the server and do a little old school terminal magic. Is light and to manage multiple computers you can open multiple terminal sessions one for each using minimum bandwidth. Let’s get to it shall we.

First establishing the connection, you have to enable SSH remote connection to your computer, for most of OS’s just enabling file sharing will do the trick. OSX will enable SSH connections just by enabling Remote Login on the Systems Preferences. If you are trying to connect to a remote server you may need to forward port 22 which is the default for SSH. The awesome thing about SSH is that is fast and super secure, it supports UNIX based OS’s, all Linux flavors like Ubuntu, Fedora, CentOS, etc… Since OSX is based on UNIX BSD is also built into the system. Windows users are left alone on this one, you should look into secure shell and learn all the commands. The general code that will get you connected follows:


You’ll get a password prompt, is this is the first time you are trying this you are going to get a server prompt asking you if you want to store an RSA key for your client. Confirm and you are ready to go. Once you are connected you’ll notice that the prompt is going to show the remote system as the terminal client.

Local_Computer:~ ssh
Remote_Computer:~ USERNAME$

If you are using Linux you have to navigate to the Applications folder and use the open command. For OSX is simpler just use the following code, in this example I’m opening Safari.

open -a Safari

To close the application, if using Linux you can use the kill command. You’ll need the PUI (Process ID) for that you can use the TOP command, that shows you a list of all running processes. For OSX we are going to use something a bit more sophisticated, a OS script. This allows the cleaning scripts to operate, like prompting the user to save a documents and leaving the application to quit closing all running processes properly. In this example I’m closing Safari.

osascript -e ‘tell application “Safari” to quit’

You can also use the kill command on OSX, very useful for unresponsive processes or applications. That’s it! Now type exit and press enter in the command window to close the ssh connection and you are done. Till the next one, peace!

No Comments, Be The First!

Your email address will not be published.