Professional Webmasters Community
Would you like to react to this message? Create an account in a few clicks or log in to continue.

Security Shell login without password

Go down

Security Shell login without password Empty Security Shell login without password

Post  andry Wed Aug 04, 2010 3:58 am

Setting up passwordless SSH login from machine LOCAL to machine REMOTE using keys carries many benefits. It can enable you to transfer files safely between these machines

even from shell scripts without the need to enter passwords. It can enable you to open an SSH terminal on the remote machine using a simple keyboard shortcut. It can enable you to

mount any accessible folder on the remote machine to a folder on the local machine and access it as a network mount.

But there are also some drawbacks. If anyone gains access to machine LOCAL machine REMOTE is compromised as well, thus reducing the security of the overall network setup. So

you have been warned. Now let's go and set this thing up.

Setting up SSH key authentication

First log in on machine LOCAL as user YOU and generate a pair of authentication keys. Leave an empty passphrase:

Code:
YOU@LOCAL# ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/home/YOU/.ssh/id_rsa):
Created directory '/home/YOU/.ssh'.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/YOU/.ssh/id_rsa.
Your public key has been saved in /home/YOU/.ssh/id_rsa.pub.
The key fingerprint is:
08:fe:a6:01:3d:f3:65:14:18:7a:10:78:20:3e:de:4e YOU@LOCAL

Once the keys have been created all you need to do to enable passwordless SSH login on the REMOTE machine is to append the just generated public key to the authorized_keys on

the REMOTE machine.

Code:
YOU@LOCAL# ssh-copy-id -i YOU@REMOTE
YOU@REMOTE's password:

In case this does not work for you you can try the manual way:

Code:
YOU@LOCAL# cat .ssh/id_rsa.pub | ssh YOU@REMOTE 'cat >> ~/.ssh/authorized_keys'
YOU@REMOTE's password:

After this step you have completed the setup of passwordless SSH authentication using SSH keys. You can try to login to the REMOTE machine, there should be no password prompt.

Code:
YOU@LOCAL# ssh YOU@REMOTE
YOU@REMOTE#
andry
andry
Moderator
Moderator

Posts : 467
Join date : 2010-05-07

Back to top Go down

Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum