Use RSA Key For SSH Authentication to Login to DreamHost
If you need to frequently login to your dreamhost account, you can always use RSA key to authentication. By using RSA key, you can login to your dreamhost SSH account without actually giving the password.
In this article, I am going to show you how to use RSA key to login to your dreamhost account.
Use of RSA keys in Linux System
In Linux system, use of RSA key is very simple. To use RSA key for SSH authentication, just follow these simple steps.
- You need RSA keys on your local Linux system. First generate the RSA keys using the following command.
#ssh-keygen -t rsa
You can select the passphrase if you want. Otherwise you can leave it blank, if you want to login to your dreamhost account without password.
- Now you need to copy content of id_rsa.pub file to the authorized_keys file at DreamHost server.
#scp .ssh/id_rsa.pub email@example.com:~/.ssh/authorized_keys
Now you are done. You can now login to your DreamHost account, using RSA key. If you have set passphrase at the time of generating RSA keys then you will be asked for passphrase otherwise you will be directly logged in to your DreamHost account.
Use of RSA keys in PuTTY
In Windows also the procedure to use RSA keys is same. You first need to generate RSA keys for PuTTY. You need PuTTYgen application for that. Download PuTTYgen.exe file from http://www.chiark.greenend.org.uk/~sgtatham/putty/download.html .
Click on the Generate button and generate a pair of private and public keys.
Now save the public and private keys.
You need to copy content of public key file to authorized_keys file. If you directly copy the public key to authorized_keys file, you will get “Server Refused Our Key” error.
You can’t copy the public key generated by PuTTYgen directly to authorized_keys. You need to modify a little bit. For example, generated public key will have this kind of content.
---- BEGIN SSH2 PUBLIC KEY ----
---- END SSH2 PUBLIC KEY ----
You need to modify it to the following kind of content.
Make sure the new generated file has only one line otherwise the key won’t work.
Now you can copy the public key to authorized_keys file.
Public key is in place now. You’ll have to set the private key to PuTTY.
Open PuTTY. Click on SSH->Auth tab in the left navigation window. Click on Browse button and select the private key generated.
Click on Open. You will be asked to enter the username. As soon as you’ll give the username, you will be logged in if haven’t set passphrase. If you have set passphrase, you’ll need to enter it. Once you will enter passphrase, you’ll be logged in.
Now you know how to use RSA keys for SSH authentication.
Go To DreamHost How To
Go To Home