This article is one of the top tutorials covering SSH on the Internet. It was originally written back in 1999 and was completely revised in 2006 to include new and more accurate information. As of October, 2008, it has been read by over 473,600 people and consistently appears at the top of Google’s search results for SSH Tutorial and Linux SSH.
Implemented Nov 5, 2015 to achieve SSH connection to my Digital Ocean Dev server. This showed me how to add SHH after I had already created the droplet.
Follow this if creating a new droplet: https://www.digitalocean.com/community/tutorials/how-to-use-ssh-keys-with-digitalocean-droplets
Step 1: Generate a key pair
First, log in to the local machine and generate a public/private key pair. I used puttygen.exe. Now store the newly-generated keys on the local machine.
Step 2: Install openSSH
Next, log in to the server you want to access remotely, then find your way to the command line. Now update the repositories and install the
SSH server as follows:
sudo apt-get update sudo apt-get upgrade sudo apt-get install openssh-server
Step 3: Install the public key
From inside the logged user’s home directory, type following commands:
mkdir .ssh nano .ssh/authorized_keys
Now copy the public key into the
authorized_keys file on a single line, save the file, and type the following commands to make sure that permissions and ownership are set properly:
chmod 700 ~/.ssh chmod 600 ~/.ssh/authorized_keys chown $USER:$USER ~/.ssh -R
Step 4: Update the SSH configuration
sshd_config, and edit the settings to reflect the following:
RSAAuthentication yes PubkeyAuthentication yes ChallengeResponseAuthentication no PasswordAuthentication no UsePAM no AuthorizedKeysFile %h/.ssh/authorized_keys
Step 5: Restart the server
Now restart the server and confirm that
SSH is running properly:
sudo service ssh restart sudo service ssh status
For troubleshooting help, type
sudo tail -f /var/log/auth.log.
Step 6: Connect from the local machine
Finally, go back to the local machine and configure PuTTY (or whatever) to make the connection.
@note: For a slightly different approach, check out Martin’s Blog – Setting Up SSH.
Completed Oct 21, 2015
Very cool/useful new feature in PuTTY called Connection Sharing.
This is especially useful if you don’t have SSH Keys setup.
Completed Oct 21, 2015
These are my top 10 favorite PuTTY Tips and Tricks:
10 – Rectangle Select
9 – Duplicate Session
8 – Scollback size
7 – Restart Session
6 – Share SSH Sessions – https://www.youtube.com/watch?v=GGYOk…
5 – View Event Log
4 – Change Background Colors and Title
3 – Serial Connections
2 – pscp and psftp
1 – SSH Keys with PuTTY Pageant Agent – https://www.youtube.com/watch?v=2nkAQ…