Thursday, June 4, 2009

Linux SSH (Secure Shell) terminal command

In most forms of Linux, you can use the SSH (Secure Shell) terminal command to connect to a remote machine running an OpenSSH server. The basic format is something like this:

ssh machinename/IP address

So, if you wanted to SSH to a machine with the IP address of, you’d use this command:


Normally, you’ll then be asked to specify a username and a password. However, you can use the SSH command-line client to pick a username beforehand:

ssh -l username

A common security measure on an OpenSSH server is to change the default TCP/IP port. By default, OpenSSH listens for requests on port 22, which means many automated cracking attempts target port 22. Changing OpenSSH’s listening port will default some of the automated attacks, which means you’ll need to specify a different port when accessing the machine. Fortunately, this is quite easy to do. For instance, if the OpenSSH server at had been configured to use port 1453:

ssh -p 1453

Finally, SSH usually works smoothly, but sometimes there can be problems. Switching SSH to verbose mode causes it to produce longer error messages, which can be useful in tracking down obscure problems:

ssh -v

No comments:

Post a Comment