Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

.ssh/id_rsa failed: permission denied

I have been scanning the web/SO and read several permission denieds plea's for help I just cant find one that solves my issue in a way i understand.

I'm following these instructions (Getting Started with Python on Heroku/Cedar). Everything went alright until:

drewverlee@ubuntu:~/helloflask$ source venv/bin/activate (venv)drewverlee@ubuntu:~/helloflask$ git push heroku master  The authenticity of host 'heroku.com (50.19.85.132)' can't be established. RSA key fingerprint is ##:##:##:##:##:##:##:##:##:##:##:## (I replaced with #) Are you sure you want to continue connecting (yes/no)? yes Failed to add the host to the list of known hosts (/home/drewverlee/.ssh/known_hosts). Permission denied (publickey). fatal: The remote end hung up unexpectedly 

(Not sure of security so i replaced the key with (#))

I think it might be because of

drwx------  2 root       root        1024 2012-03-08 21:26 .ssh 

because

drewverlee@ubuntu:~$ ssh-keygen Generating public/private rsa key pair. Enter file in which to save the key (/home/drewverlee/.ssh/id_rsa):  Enter passphrase (empty for no passphrase):  Enter same passphrase again:  open /home/drewverlee/.ssh/id_rsa failed: Permission denied. Saving the key failed: /home/drewverlee/.ssh/id_rsa. 

As someone with little experience in these matters i'm not sure how to undo what i have done safely as i know i'm meddling with powerful tools. Any advice on whats going on here? Let me know if i need to include more information to solve the problem.

like image 747
Drew Verlee Avatar asked Mar 09 '12 15:03

Drew Verlee


People also ask

How do I fix SSH permissions denied?

If you want to use a password to access the SSH server, a solution for fixing the Permission denied error is to enable password login in the sshd_config file. In the file, find the PasswordAuthentication line and make sure it ends with yes . Find the ChallengeResponseAuthentication option and disable it by adding no .

Why does SSH say Permission denied?

This error comes up when using a wrong private key or no key at all when trying to connect via SSH. To resolve the problem, you should generate a new key pair and connect using that new set of keys.

What is the permission of Id_rsa?

~/. ssh/id_rsa Contains the private key for authentication. These files contain sensitive data and should be readable by the user but not accessible by others (read/write/execute). ssh will simply ignore a private key file if it is accessible by others.


1 Answers

You should own the permissions to the .ssh dir in your own directory, but in your case, it's owned by root. Try

cd ~ sudo chown drewverlee .ssh 

and then retry creating keys and connecting.

like image 181
Mark Fisher Avatar answered Sep 17 '22 18:09

Mark Fisher