Installing OpenSSH Server on Ubuntu
This tutorial should work on any distro based on Debian, but I have
only tested it on Ubuntu 12.04.4.
You will need to run the commands as root or via sudo, which is the prefered method for Ubuntu.
If you decide to install OpenSSH-server, make sure you are using a strong password, at least 10 to 15 characters long, or use key-based authentication.
In order to install OpenSSH-server, you need to run this command, which will get an updated list of avalible packages and then install openssh-server.
sudo apt-get update && sudo apt-get install openssh-server
Once it is installed, you can connect by typing this from another Linux or OSX machine:
You can connect from a Windows machine by using one of the various SSH clients out there. I use PuTTY, myself.
The configuration file for sshd is called sshd_config and is located in /etc/ssh/. It is commented, so you can see what the various options do. You can also look at the man page as well: man sshd
For the most part you can leave most of the settings alone, but I recommend changing two settings - LoginGraceTime and PermitRootLogin.
I changed LoginGraceTime to 20:
That means it will allow someone to sit at the login prompt for only 20 seconds, instead of 2 minutes.
I also changed PermitRootLogin to without-password. You can set this option to yes, no, or without-password
That means that you will not be able to login as root at all. If you need root access, you can just login as your normal user and then use sudo or su to get to a root prompt.
Note: Be sure to create another user if you are going to disallow root logins and root is the only account on your server.
Whenever you make a change to the sshd configuration, make sure to restart sshd:
sudo service ssh restart
That is it, enjoy having SSH access.