How to Connect to a Remote Server via SSH from a Linux Shell

How to Connect to a Remote Server via SSH from a Linux Shell

 
 

Introduction

Secure Shell (SSH) is a UNIX-based command interface and protocol for securely getting access to a remote computer. SSH is actually a suite of three utilities - slogin, ssh, and scp - that are secure versions of the earlier UNIX utilities, rlogin, rsh, and rcp. SSH commands are encrypted and secure in several ways. Both ends of the client/server connection are authenticated using a digital certificate, and passwords are protected by being encrypted.

SSH allows you to connect to your server securely and perform Linux command-line operations.

 

SSH using sudo

 

For high-level tasks coupled with increased security, you can set up a sudo user instead. This user normally functions as a lower-level user, but can perform the same tasks as root when necessary.

For all examples that pertain to the root user, a sudo user can do the exact same thing by adding sudo in front of the rest of the command. You will be prompted for the root password, and then the command will execute.

Example root command:

          top

Same command for a sudo user:

          sudo top

Connect to the server

Open your SSH client.
To initiate a connection, type:

ssh [email protected]

NOTE:

If you are trying to connect as a sub-FTP user, you will want to use the following command context:

ssh subftpuser%[email protected]

Make sure you use your own domain name or IP address. If you want a user other than root, type the other username before the @ symbol.

Type:

ssh [email protected]

OR (IP address version)

ssh [email protected]

OR (domain FTP user version)

ssh [email protected]

Be sure to replace xxx.xxx.xxx.xxx with your server's IP address. Type:

ssh [email protected]

If this is your first time connecting to the server from this computer, you will see the following output. Accept the connection by typing "yes."

The authenticity of host 'example.com (12.33.45.678)' can't be established.
RSA key fingerprint is 3c:6d:5c:99:5d:b5:c6:25:5a:d3:78:8e:d2:f5:7a:01.
Are you sure you want to continue connecting (yes/no)?
yes

You will now be prompted to enter your password. Please note that you will NOT see your cursor moving, or any characters typed (such as ******), when typing your password. This is a standard Terminal security feature. Hit enter.
You can also copy and paste, using Command+V to paste.

Password:

That's it, now you're connected to your Hosting service via SSH.

You are now logged into your Grid via SSH. You should see output like this:

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
[email protected]:~$

You are now logged into your server via SSH. You can begin typing commands at the prompt.

The output will look something like this:

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
[email protected]:~$

To connect 'to' a certain port when ssh'ing.

 

ssh [email protected] -p XXX

where xxx is the port number

That's all for this short tutorial on how to connect to a remote server via ssh from a linux shell

 
 

tags: ssh server linux


We use our own cookies and third-party cookies to improve our services, show products based on your preferences, analyse the browsing habits of our users, and enable interaction with social networks. Continuing to browse our sites implies full acceptance of their use. You can change your cookie setting or get more information here: Cookies policy .