alifity

step.next()

 

Passwordless SSH on Site5

Thursday, August 20, 2009 in recipes | Comments
 

OpenSSH

Connecting to remote computer via SSH protocol will always be fun. Above all, it’s secure. SSH connection usually run on port 22 and use combination of username and password to connect on remote host. Because everything is encrypted, the connection is a little bit slower than other protocols. That’s ok, since the connection more secure ;).

Recently, I moved my hosting to Site5. Site5's hosting features that offer SSH access drive me faster to buy it. After enabled it on Cpanel, then I have a SSH connection parameters on my hands. Just issue this command to connect:

:~ % ssh username@remotehost

If you in windows, you can use Putty, a free SSH client.

Then type your password on password prompt, then [ENTER], now you are connected.

Ok, I am sure you understand that simple mechanism. Now, let me show you how to do passwordless SSH.

On you local computer type:

:~ % ssh-keygen -t dsa
Generating public/private dsa key pair.
Enter file in which to save the key (/home/username/.ssh/id_dsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/username/.ssh/id_dsa.
Your public key has been saved in /home/username/.ssh/id_dsa.pub.
The key fingerprint is:
59:8e:28:5f:99:55:de:07:11:1e:a8:f9:b9:df:07:ba username@hostname

As you can see above, there are two files that are generated by ssh-keygen command, id_dsa and id_dsa.pub. id_dsa is like private key, and id_dsa.pub is a public key, you can read more detail about Public key cryptography on Wikipedia.

Then, copy id_dsa.pub to Site5, then rename it as authorized_keys in folder .ssh on your home directory. To simplify this process, you can issue this command:

:~ % scp .ssh/id_dsa.pub username@hostname:.ssh/authorized_keys
Above command will transfer id.ssh/_dsa.pub from local computer to .ssh/authorized_keys on remote host.

Congratulations, now you have passwordless SSH connection. If you have any trouble you can read here or you can post it on comments below. See you on next post ;).

My Domain, My OpenID
Web Scraping.. Learn the Basic
blog comments powered by Disqus