Enter your email address:

Delivered by FeedBurner

How to login in a remote server using SSH and no password


StumbleUpon Toolbar

If you would like to connect to your machine through ssh without being asked for a password you should do this.

  1. Create a public/private key pair
  2. ssh-keygen -t rsa

    Please Do not forget not to write any passphrase, just empty for no passphrase for this to work

  3. Copy te file id_rsa.pub to the $HOME/.ssh directory of the machine you wish to connect to, where $HOME is the directory of the user you would like to connect as. /root/.ssh in the case you would like to connect as root. Consider you would like to connect as the user user
  4. scp $HOME/.ssh/id_rsa.pub usuario@server.remoto:/home/user/.ssh/authorized_keys2

    or

    ssh-copy-id ~/.ssh/id_rsa.pub username@example.com

  5. Now you can connect to the remote server with out being asked for a password.
  6. ssh -l usuario server.remoto

    Trackback URL for this post:

    http://www.go2linux.org/trackback/16
StumbleUpon Toolbar

 If you like this article, subscribe to our full rss

If this article was somehow useful for you, you can leave something in the tip's jar

Please post your question in our forum and use comments only to leave your comments about the article, thanks.

Hello, After performing the

Hello,

After performing the above steps also im not able to login to the remote server with out password.

Is there any pre requesits to be done for this to work with out password.

It should work on clean

It should work on clean installations, which systems are you using? are you able to log in with password?, also be sure you are using a login name that already exists on the destination machine.

Guillermo Garron

I am assuming that you will

I am assuming that you will be using user root on both machines for password less login

-------------------------------------------------------
THIS IS A TEST CASE, DO NOT DO IT ON PRODUCTION MACHINE
-------------------------------------------------------

Steps.

1. Login as root
2. ls -al /root/
3. try to find a folder ".ssh"
4. if their is a folder .ssh delete it by using following command
5. rm -rf .ssh --->>> press enter folder will be deleted
6. Now generate ssh keys, follow steps
7. ssh-keygen -t rsa -->> press enter
8. you will be asked to type pass phrase, --->>> just press enter
9. Press enter again & again untill you get command prompt again.
10. ls -al /root/ again for directory list, try to find ".ssh" folder
11. now cd .ssh
12. ls -al --->> you will find few files one of them will be "id_rsa.pub"
13. copy this file to another linux machine, follow steps
14. I assume that ssh server is already installed on both machine
15. use the following command to copy file to 2nd linux machine
16. scp /root/.ssh/id_rsa.pub root@your_2nd_linux_PC_IP:/root/
17. you will be asked for root password, type your password, press enter
18. now log on to 2nd linux pc as root
19. type the sequence of following commands
20. ls -al /root
21. try to find folder ".ssh"
22. if it is their then follow the command sequence below, or create .ssh folder by typing following command
23. mkdir .ssh
24. now add the key to your authorised keys, follow the steps
25. cat /root/id_rsa.pub >> /root/.ssh/authorized_keys --->> press enter
26. go back to your 1st linux PC, type the following command
27. ssh root@your_2nd_linux_PC_IP
28. you should be loged in to 2nd linux PC without any password
29. repeate step 16 to 27 on all machines you want to logon without password

Post new comment

The content of this field is kept private and will not be shown publicly.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
  • Lines and paragraphs break automatically.

More information about formatting options

Captcha
This question is for testing whether you are a human visitor and to prevent automated spam submissions.

This site is proudly hosted at Bluefur Hosting