ServerPronto Dedicated Servers
       ServerPronto Home   ServerPronto University     
ServerPronto University  

Support of the day: SSH Keys (Passwordless login via SSH)


December 15th, 2011


This week’s tip: SSH Keys (or i do not like typing my long cryptic password everytime I need to access my server)
If you’ve been following my other tips you might remember that ssh uses different authentication options, credentials, domain login, password, you name it, one of these is via ssh keys.


Imagine your car. You’re used to use a key to open the door and start the engine once or twice per day. How about if you were a messenger that has to do this 40, 50, 60 times per day, it gets tiresome, wouldn’t it be great for the car to open the door and automatically start the engine when it senses that it’s you?
Same principle, bit different.
(Please note, that this tutorial is aimed to linux to linux connections, putty has a local key generator that could be technically used as the same.)


1. Creating the keys and their folder
First, create the local folder, type mkdir /home/$USER/.ssh (type it just like that)
Then the key: ssh-keygen -t dsa (anything it asks just press enter)


2. Copying the key to the remote server
Move to the ssh folder: cd /home/$USER/.ssh
Copy the file: scp id_dsa.pub yourremoteuser@remoteip:./id_dsa.pub


3. Adding the key on the remote server
First log in to the remote server via ssh as usual
Then add the key to the remote server’s key list:
cd /home/remoteusername/
mkdir .ssh
mv id_dsa.pub .ssh/
cd .ssh/
check if there is a file named authorized_keys, if not then create it:
touch authorized_keys
finally add the key:
cat id_dsa.pub >> authorized_keys


4. Activating the keys usage on the remote server.
Type: nano /etc/ssh/sshd_config
And look for AuthorizedKeysFile and make sure that it’s uncommented (meaning that there is no # symbol before that word) and that next to it says .ssh/authorized_keys
Save (ctrl + x) and restart the ssh service.


5. Testing.
Log out of the remote server and try to login again, this time it will not ask for a password.



Entry Filed under: Support of the day

 

Leave a Comment

hidden
Comment:

Some HTML allowed:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Trackback this post  |  Subscribe to the comments via RSS Feed

 
Infolink ServerPronto Infolink Review Our Guarantee Why Choose ServerPronto? Why Choose ServerPronto? Review Our Guarantee Home About Why Choose ServerPronto? Compare Packages Frequently Asked Questions (FAQ) Order Now!