Use the SSH Command in Linux

Log in and work on any Linux computer anywhere in the world

The Linux ssh command accesses a remote computer using a secure encrypted connection between the two hosts over an insecure network. The command opens a window on your local machine, through which you can run and interact with programs on the remote machine. An ssh Linux session is encrypted and requires authentication. ssh stands for Secure SHell, referring to the operation's inherent security.

SSH command on Ubuntu Linux Terminal

Usage Examples

These examples assume you're using SSH with a remote computer that accepts passwords. Read more about SSH key authentication for a more secure method of using SSH that does not require passwords.

To log in to a computer with a specified network id ( and a specified username (jdoe), use the following command:


If the username of the remote machine is the same as on the local machine, omit the username in the command:


If it's your first login attempt on that machine, you'll encounter a one-time fingerprint alert:

The authenticity of host '' cannot be established. DSA key fingerprint is 04:48:30:31:b0:f3:5a:9b:01:9d:b3:a7:38:e2:b1:0c. Are you sure you want to continue connecting (yes/no)?

Enter yes to tell the machine to add the remote computer to your list of known hosts, ~/.ssh/known_hosts. You'll see a message such as this:

Warning: Permanently added '' (DSA) to the list of known hosts.

Once you're connected, you're prompted for a password. After you enter it, you'll see the shell prompt for the remote machine.

You also can use an ssh command to run a command on a remote machine without logging in. For example:

ssh ps

executes the ps command on the computer called and shows the results in your local window.

Why Use SSH?

SSH is more secure than other methods of establishing a connection with a remote computer because you send your login credentials and password only after a secure channel has been established. Also, SSH supports public-key cryptography.

Was this page helpful?