Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

SSH Key: “Permissions 0644 for 'id_rsa.pub' are too open.” on mac

I generate a ssh key pair on my mac and add the public key to my ubuntu server(in fact, it is a virtual machine on my mac),but when I try to login the ubuntu server,it says:

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @         WARNING: UNPROTECTED PRIVATE KEY FILE!          @ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ Permissions 0644 for '/Users/tudouya/.ssh/vm/vm_id_rsa.pub' are too open. It is required that your private key files are NOT accessible by others. This private key will be ignored. bad permissions: ignore key: /Users/tudouya/.ssh/vm/vm_id_rsa.pub Permission denied (publickey,password). 

I have tried many ways to solve this, change the key file mode, change the folder mode,as some answer on stackoverflow,but it doesn't work.
the key file permission:

vm dir: drwxr-xr-x   4 tudouya  staff    136  4 29 10:37 vm  key file: -rw-------  1 tudouya  staff  1679  4 29 10:30 vm_id_rsa -rw-r--r--  1 tudouya  staff   391  4 29 10:30 vm_id_rsa.pub 

please give me some idea... =========================================

I write the host infomation to ssh_config:

Host ubuntuvm     Hostname 10.211.55.17     PreferredAuthentications publickey     IdentityFile /Users/tudouya/.ssh/vm/vm_id_rsa.pub 

I run command "ssh -v ubuntuvm",it displays:

ssh -v ubuntuvm OpenSSH_6.2p2, OSSLShim 0.9.8r 8 Dec 2011 debug1: Reading configuration data /etc/ssh_config debug1: /etc/ssh_config line 20: Applying options for * debug1: /etc/ssh_config line 103: Applying options for * debug1: /etc/ssh_config line 175: Applying options for ubuntuvm debug1: Connecting to 10.211.55.17 [10.211.55.17] port 22. debug1: Connection established. debug1: identity file /Users/tudouya/.ssh/vm/vm_id_rsa.pub type 1 debug1: identity file /Users/tudouya/.ssh/vm/vm_id_rsa.pub-cert type -1 debug1: Enabling compatibility mode for protocol 2.0 debug1: Local version string SSH-2.0-OpenSSH_6.2 debug1: Remote protocol version 2.0, remote software version OpenSSH_6.6.1p1 Ubuntu-8 debug1: match: OpenSSH_6.6.1p1 Ubuntu-8 pat OpenSSH* debug1: SSH2_MSG_KEXINIT sent debug1: SSH2_MSG_KEXINIT received debug1: kex: server->client aes128-ctr [email protected] none debug1: kex: client->server aes128-ctr [email protected] none debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<1024<8192) sent debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP debug1: SSH2_MSG_KEX_DH_GEX_INIT sent debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY debug1: Server host key: RSA 55:6d:4f:0f:23:51:ac:8e:70:01:ec:0e:62:9e:1c:10 debug1: Host '10.211.55.17' is known and matches the RSA host key. debug1: Found key in /Users/tudouya/.ssh/known_hosts:54 debug1: ssh_rsa_verify: signature correct debug1: SSH2_MSG_NEWKEYS sent debug1: expecting SSH2_MSG_NEWKEYS debug1: SSH2_MSG_NEWKEYS received debug1: Roaming not allowed by server debug1: SSH2_MSG_SERVICE_REQUEST sent debug1: SSH2_MSG_SERVICE_ACCEPT received debug1: Authentications that can continue: publickey,password debug1: Next authentication method: publickey debug1: Offering RSA public key: /Users/tudouya/.ssh/vm/vm_id_rsa.pub debug1: Server accepts key: pkalg ssh-rsa blen 279 @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ @         WARNING: UNPROTECTED PRIVATE KEY FILE!          @ @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@ Permissions 0644 for '/Users/tudouya/.ssh/vm/vm_id_rsa.pub' are too open. It is required that your private key files are NOT accessible by others. This private key will be ignored. bad permissions: ignore key: /Users/tudouya/.ssh/vm/vm_id_rsa.pub debug1: No more authentication methods to try. Permission denied (publickey,password). 
like image 561
土豆丫 Avatar asked Apr 29 '15 03:04

土豆丫


People also ask

How do I fix permissions 0644?

To overcome the error message, you will need to change the file permissions for the private key such that it is readable only by you. This will allow only your user to read (and not write and execute) the private key file and prevent everyone else from reading, writing and executing the file.

What should be the permission for id_rsa pub?

ssh/id_rsa. pub ) are correct. chmod 644 ~/.

How do I access my ssh public key Mac?

To get started, you need to open the Terminal application which is found in Applications > Utilities > Directory, but you can also launch this by hitting cmd+spacebar and typing “Terminal” into the search box and then return. Once open you will be greeted with a window where your cursor is just after a $ symbol.

Are too open id_rsa?

Permissions 0644 for 'id_rsa' are too open. It is required that your private key files are NOT accessible by others. It is required that your private key files are NOT accessible by others. This private key will be ignored.


1 Answers

I suggest you to do:

chmod 400 ~/.ssh/id_rsa

It works fine for me.

like image 89
Rick Benetti Avatar answered Oct 05 '22 15:10

Rick Benetti