How to connect to a remote server using SSH on Ubuntu

SSH is a network protocol used for performing remote operation securely, including command-line logins, command executions and data communications. The ssh command in Unix operating systems implements the SSH protocol between an SSH client running on the local machine and an SSH server running on the remote machine. SSH has a range of specific applications, depending on the user's requirements. Ubuntu sers typically use ssh to connect to a remote server, which is often a Virtual Private Server (VPS). The most important part of this task is knowing a user name and password for the remote server.
DIFFICULTY Basic - 1 | Medium - 2 | Advanced - 3
TIME REQUIRED 5 min
RELATED PRODUCTS Linux-based VPS or dedicated servers

Here is a quick tutorial on how to connect to a remote server using ssh on Ubuntu.

Connect to the remote server with your own user name

Open a terminal window from your desktop while signed on as an ordinary user. The user name in this example is test.

Connect to the SSH server with your local user name by using the following command:

$ ssh localhost

The localhost parameter in the example above may be a domain name or IP address. This would normally be a remote host, although this example uses the local machine for demonstration purposes. Enter the password for your user name when prompted to connect to the SSH server. Note the change in the prompt from /$ to ~$ .

Return to the local session with the exit command.

Connect to the remote server with a different user name

Open a terminal window from your desktop while signed on as root.

Connect to the SSH server with the test user name by using the following command:

# ssh test@localhost

Again, this example uses localhost for the SSH server. Enter the password for test when prompted to connect to the SSH server. Note the change in the user name from root to test, indicating the remote login was successful.

Return to the local session with the exit command.


Was This Article Helpful?
Thank You For Your Feedback
Glad we helped! Anything more we can do for you?
Sorry about that. How can we be more helpful?