{ 34 comments… read them below or add one }

1 pH July 28, 2008 at 3:21 pm

The permissions of .ssh should not be 755 and 644 for authentication_keys
It should be 700 and 600.

2 Jeremy August 6, 2008 at 1:18 pm

Step 4 refers to a file named “authorized_key” (“chmod 644 ~/.ssh/authorized_key”). It should be “authorized_keys” instead of “authorized_key”.

3 Ramesh August 6, 2008 at 2:45 pm

Jeremy,

Thanks for pointing it out. I had it correct on step#3 and made a typo on step#4.

I have corrected step#4 properly now.

4 shiva chandar December 23, 2008 at 8:47 am

Thank you so much for the information. I got it…!!!!!!!! :)

5 steve nieves September 17, 2009 at 8:19 pm

Thank you. I was not sure if this would apply to my ubuntu system on my netbook but it worked flawlessly.

6 satheesh mohan June 21, 2010 at 11:48 pm

I did everything as mentioned above. But unable to perform scp or ssh without a password prompt.

7 john February 1, 2011 at 4:41 pm

Thanks for the stuff, did just as you exlpained

8 Paul February 11, 2011 at 11:27 pm

Thanks for the notes on how to get ssh-agent up and running. Good concise info. All worked as expected after I followed along with this article.

Thanks!

9 John May 12, 2011 at 3:41 pm

Most excellent article. Clear, concise, and to the point. It works on AIX and OpenSSH versions 0.9.8g and 1.0.0a. Thanks!

10 K.Bala November 2, 2011 at 2:43 am

Thanks..
Good Stuff, it’s worked me..

11 dexter January 28, 2012 at 7:29 am

Hi,

Awesome explaination…I have a doubt…..after connecting to remote host is there any way to come back to the localhost through any command instead of opening a new session.

12 abhay February 5, 2012 at 9:03 pm

Is there anyway I can use Centralized CA to use PKI and What about CISCO devices?

13 Tom February 12, 2012 at 10:58 am

Thank you thank you thank you.

Have been meaning to put a proper backup solution in place for my site, but am a relative noob when it comes to linux. Followed this and it works perfectly, first time

Thanks again!

14 prateek February 14, 2012 at 11:08 pm

Thank u soo much ..

this really works for me .

15 dhongki February 16, 2012 at 9:02 pm

is this possible to use in crontab?

16 dhongki February 16, 2012 at 11:18 pm

the problem i found with this one is that when you close the terminal you have to re-run again the ssh-agent and re-enter a passphrase in ssh-add

17 Michael February 28, 2012 at 12:03 am

Thanks! It works very well.

18 Daniel April 2, 2012 at 4:51 am

Thanks !! its very usefull

19 Deepak April 16, 2012 at 2:59 am

Hi
i followed the above method procedure but the login didnt happen without the password prompt, i have host machine as OSX, and trying to login to remote machine which is launched, on virtual box which is Linux machine.

20 Anonymous June 8, 2012 at 9:17 pm

It is absolutely fantastic blog to learn different stuff regarding the linux

21 blackcat August 7, 2012 at 9:42 am

on step 5 , it doesn’t prompt for passphrase., simply logs-in-to remote server.
But there it still asks for password..

22 siva kesava November 16, 2012 at 9:30 am

This info very useful and clear to generate RAS

Thank you so much

23 Eric Koester November 24, 2012 at 1:32 pm

In step 3, you don’t show HOW to copy the file from the local machine to the remote machine.
Could you fill in that step, please?
Thanks!

24 Haytham A January 11, 2013 at 8:12 pm

Thank for a well written post.
I was able to remote copy without having the ssh-agent running. I don’t think it is a required step.
One of the comments asked for an example of copying from a local to a remote machine. Here is one:
scp mylocalfile userNameForRemoteMachine@remoteMachine:/some/directory/on/remote/machine

Of course instead of a single file you can specify a directory and use the -r directive to copy all its contents recursively.

25 rajesh January 17, 2013 at 6:10 am

Thanks for the steps mentioned
Is it possible to scp using the same steps from linux to windows …
i tried a lot to do it with out password from linux to windows but not able to succeed … Please help if any changes are required or to install some thing else …

26 Pankaj February 17, 2013 at 4:09 pm

Thanks for the info.
I had searched a number of places before I landed here. It really is a concise article. Very clear and easy to follow steps.

27 jet July 5, 2013 at 3:14 am

This is a great help for me, especially step 6 and 7. Thank you for info.

28 Ryan August 4, 2013 at 2:00 pm

I tried following your instructions. However, when I ssh into the remote host, it asks me for a password. I am needing to do this with no password so I can set up a cron to transfer files from the remote to local machine. I added the key to the “authorized_keys” file on the remote server.

I am confused about step 5: [local-host]$ ssh -l jsmith remote-host

It only works for me if I so ssh -l root remote-host, and, of course, I have to enter a password still. Thanks.

Maybe it’s worth mentioning I’m on an EC2 Amazon server. My username is “ubuntu” by default.

I tried generating a second key pair, with no passphrase, but it didn’t work either.

Forgot to check” notify me of followup” on the last one…so if you responded to that one, I might not ever see it, so I”m sending this note in case you just respond to the last one you see.

29 Rishi September 10, 2013 at 3:15 pm

Your examples are very clear and concise. Thanks!
–rishi

30 Anonymous September 17, 2013 at 7:43 am

Hi Ramesh,

I have been trying to tranfer script to the newly deployed Linux m/c.
My requirement is ,as its newly deployed linux machine when i try to do scp, it will ask me to provide Key authentication. i am automating a task where i need to send file to the new machine and execute it there.

Can you please share your idea to come out of the issue

Regards
Vishwa 

31 Jeroen October 9, 2013 at 3:03 am

If you opt for the ssh keypair without passphrase, try and make things as secure as possible by setting the account on the other side as scp only.

You can do this by setting the shell for that user as /bin/false and chroot-ing the user to it’s homedir via de sshd_config file (you can specify users and/or groups).

32 Mario de Sá Vera December 19, 2013 at 4:09 pm

Dear Ramesh,

good to be dealing with the ones that know what they are talking about !!!

thanks for you post , it was the only one that worked it out alright !

Mário.

33 Sivagnanam March 7, 2014 at 12:06 pm

Hi Ramesh,
The Geek Stuff is always an important website for me, Basically It encourage me to learn technology. Especially it make passion toward linux and opensource. I thank you for such work. All your tips are worth and important for me.

Thanks and regards,
Sivagnanam A.
Tamilnadu, India.

34 Kenny Black April 17, 2014 at 9:49 am

I can SSH without a password prompt, but scp still prompts for a password. Is there a way around this?
Thanks,
Kenny Black

Leave a Comment

Previous post:

Next post: