Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I changed my permissions in my .ssh folder and now when I use a piece of software that uses my private key, I have to type my password each time. What should my permissions be on my id_rsa file to not have to type a password each time I use an app that uses it?

Currently my permissions are set to:

-rw-------@ 1 Jody  staff   114 Nov  4 23:29 config

-rw-------  1 Jody  staff  1743 Oct 21  2009 id_rsa

-rw-------@ 1 Jody  staff   397 Oct 21  2009 id_rsa.pub

-rw-------@ 1 Jody  staff  3855 Sep 13 22:35 known_hosts

Thanks

share|improve this question

migrated from stackoverflow.com Nov 27 '10 at 2:02

This question came from our site for professional and enthusiast programmers.

4 Answers 4

Typically you want the .ssh directory permissions to be 700 (drwx------) and the public key (.pub file) to be 644 (-rw-r--r--). Your private key (id_rsa) should be 600 (-rw-------).

I am asssuming that you mean that you have to enter your system/user password each time, and that previously you did not have to. cdhowie's response is assuming you set a password/passphrase when generating your keys, and if you did then as he says you will have to enter your password every time unless you use an ssh agent.

share|improve this answer
1  
I found elsewhere that if using the authorized_keys file, that it should be chmod'd to 640, ie -rw-r----- . –  AnneTheAgile Sep 11 at 21:19

Also ensure that your home directory is not writeable by other users.

chmod g-w,o-w ~

share|improve this answer
7  
chmod g-w,o-w ~ –  Kokizzu Apr 6 '13 at 13:22

Permissions shouldn't have anything to do with this. Your private key is encrypted with the password, so you need to enter it for the private key to be decrypted and usable.

You might consider running an ssh agent, which can cache decrypted keys and will supply them to applications that need them.

share|improve this answer
    
Thanks for the additional info about the ssh agent. Looks like there is one built into Leopard so I think I'll do that. Having a bit of trouble with it but I'll ask another question. –  Jody G Nov 26 '10 at 22:18

Felipe is correct -- the directory containing your .ssh directory must not be writeable by group or other. Thus chmod go-w ~ is the next logical thing to try if you are still prompted for a password when ssh'ing after running ssh-keygen -t rsa; cp ~/.ssh/id_rsa.pub ~/.ssh/authorized_keys, assuming you don't assign a passphrase in the ssh-keygen command, and your .ssh directory is in your home directory.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.