===========
You need to make sure that server accepts password less connections or logins. That means enabling the public key authentication to the server. In order to make this you need to uncomment(If the line is existing) or add(If the lines are not present) the following lines.
Steps
====
Login to the server in which you need to set up the password less login.
1. Login as root.
2. vim /etc/ssh/sshd_config
3. Uncomment the following lines
#RSAAuthentication yes
#PubkeyAuthentication yes
If the line is not present in the file
You can add this using the following command
echo -e "RSAAuthentication yes \nPubkeyAuthentication yes" >> /etc/ssh/sshd_config
4. Restart you ssh service
service sshd restart
or
/etc/init.d/sshd restart
5. Run this script
if [ -d /root/.ssh ] ; then echo fine; else `mkdir /root/.ssh`;fi;chmod 700 /root/.ssh
6. Thats up to the server side
Client side Configurations
------------------------
First of all we need to setup a keypair. If you already have the files ~/.ssh/id_rsa and ~/.ssh/id_rsa.pub, We can proceed further with the same. If not, then we need to add them. Use the following command:
ssh-keygen -t rsa
You will then be asked some questions. Simply hit “Enter” to answer them all:
Generating public/private rsa key pair.
Enter file in which to save the key (/home/bestval/.ssh/id_rsa): (By default it will be saved in the .ssh folder of the user's home directory with the name id_rsa )
Enter passphrase (empty for no passphrase): (If you need additional security you can enter the passphrase, which is used to open the generated file.)
Enter same passphrase again:
Your identification has been saved in /home/bestvale/.ssh/id_rsa.
Your public key has been saved in /home/bestval/.ssh/id_rsa.pub.
Answering without putting in a password means that the keys can be unlocked without a password, which is the whole point of “passwordless” login.
Then there is a little steps to be completed.
Either you can copy the Public in to the server by simply SCP the file in to the server
For Eg:
Simply you can use the command
ssh-copy-id -i ~/.ssh/id_rsa.pub username@remote_host
This will ask the password and give the corresponding user's password
or
scp /home/bestval/.ssh/id_rsa.pub. username@IP address://user's directory name/.ssh/
This will ask the password and give the corresponding user's password
Replace the user with the username and home directory with user's home directory in the above document.
1 comment:
why are u people copy pasting.
This info in available any where in web.
Post a Comment