SSH is a powerful tool for accessing the terminal remotely and doing file transfers over an encrypted connection. With this small guide you’ll be able to SSH in to your Ubuntu 16.04, Debian 8.6 or CentOS 7 server using OpenSSH.
Both Ubuntu minimal/server and Debian give you the option to install OpenSSH server during the install process. You’ll only need to follow these steps if you didn’t select to install it during the OS installation process.
This will update the package lists from the repositories and install OpenSSH server package.
user@ubuntu:~$ sudo apt-get update && sudo apt-get install openssh-server -y
First we’ll need to gain root access (Skip this step if you’re already logged in as root) by typing “su”.
user@debian:~$ su Password:
Now we update the package lists from the repositories and install OpenSSH server package.
root@debian:/home/user# apt-get update && apt-get install openssh-server -y
CentOS comes with OpenSSH listening on a fresh install so you shouldn’t need to install it yourself. If you do find yourself needing to install it you can use this command while logged in as root.
[root@centos ~]# yum -y install openssh-server
To connect to the server you’ll need to know it’s IP. Presuming it’s been handed one by a DHCP server, all you need to do is type “hostname -I” and it will spit it out in the terminal.
user@Debian-vm:~$ hostname -I 192.168.1.12
Linux & MacOS
You can connect to the server by typing “ssh USER@ADDRESS”. If it’s the first time connecting to the server you’ll likely have to accept it’s key by typing “yes”.
john@Debian-vm:~$ ssh firstname.lastname@example.org email@example.com's password: Welcome to Ubuntu 16.04.1 LTS (GNU/Linux 4.4.0-47-generic x86_64) * Documentation: https://help.ubuntu.com * Management: https://landscape.canonical.com * Support: https://ubuntu.com/advantage Last login: Mon Nov 14 17:24:57 2016 from 192.168.1.12 john@Ubuntu-mini-vm:~$
Just note, Debian won’t let the root user login by default. You can change that in a config file.
Once you have it open all you have to do is type in the IP of the server and, as long as it’s on the same network, it’ll connect! If it’s the first time you’re connecting you’ll be prompted with a box to accept the key. This is so your computer knows if it’s connecting to the same server in the future (if it’s a different server, it’ll have a different key and you’ll be prompted again.)