This how-to will show how to use the OpenSSH program to connect one Linux server to another via command line. It’s a very simple process that requires little know-how, but can be useful for many projects. Normally, on Windows, you would just use the software PuTTY to connect through SSH, but this isn’t available for Linux devices.
- Root/administrative access to your server. If you do not have a server and need one, Atlantic.Net offers reliable cloud hosting options.
With most versions of Linux, OpenSSH already comes installed for client and server side. To make sure it’s installed on both ends, we will first run an install on both sides. Run the following commands to install the server and client software needed:
sudo apt-get install -y openssh-server openssh-client
CentOS/Fedora (Fedora uses ‘dnf’ now, but will still install with ‘yum’):
sudo yum install -y openssh-server openssh-client
sudo pkg install openssh-server openssh-client
sudo pacman -S openssh
Once OpenSSH is installed, make sure the service is running. You can check if it’s running with the following:
service sshd status
systemctl status sshd
Connecting to an External Server
At this point, you’re ready to connect! Normal syntax for connecting with OpenSSH is as follows:
ssh <[email protected] or [email protected]>
Once you connect to your external device, you’ll see the following which is the RSA negotiation between both devices to ensure you’re connecting to the right host:
The authenticity of host '69.28.xx.xx (69.28.xx.xx)' can't be established.
RSA key fingerprint is 75:98:a9:3d:f8:e7:48:bf:05:c9:1b:ea:xx:xx:xx:xx.
Are you sure you want to continue connecting (yes/no)? yes
You can choose to add this RSA key permanently to your SSH configuration so this external host is permanently stored with this key. This is normally seen as fine unless you’ll be modifying the SSH configuration of the external host frequently. This will prevent people with malicious intent from impersonating the server you’re connecting to or from performing ‘man-in-the-middle’ attacks.
Warning: Permanently added '69.28.xx.xx' (RSA) to the list of known hosts.
Afterwards, you will be prompted for the password of the user you logged in as. If you didn’t specify a user, it will automatically log in as ‘root’.
[email protected]'s password:
Last login: Mon Apr 25 06:25:43 2016 from 209.208.xx.xx
Enter the password for your user and you’re good to go!
Thank you for following along with this how to on connecting to your Linux server with OpenSSH. Learn more about our affordable cloud hosting solutions and be sure to check back with us again for updates and further tutorials, like How to SSH to Server via Linux.