In my .ssh/ directory, when running

$ ssh-add dev 
Permissions 0755 for 'dev' are too open.

But looking at the dev file

$ ls -lF dev
-rw-------@ 1 me  staff  1675 Feb  3 09:37 dev

The @ at the end means that there are extended attributes. So I then run

$ xattr dev

These have no meaning to me. It looks to me that the permissions are what they should be (600) where is the discrepancy coming from, and how do I fix it?

  • These extended attributes are usually attached when you download the file from the Internet with Safari, Chrome or some download manager. I find it curious why you download a private key from the Internet, if that is indeed the case. – Siyuan Ren Mar 5 '15 at 4:02
  • The key came through Skype from another user. – scott m gardner Mar 5 '15 at 13:33

I assume your working directory is ~/.ssh/ when you run ssh-add, ls and xattr.

I suspect there is a subdirectory named dev (i.e., ~/.ssh/dev/). Check for it with ls -lFd dev.

ls normally lists the contents of a directory. Adding the -d option lists a directory as a directory itself.

Further, I suspect that there is a file, ~/.ssh/dev/dev which is what ls -lF is displaying the information about.

If my suspicion is correct, xattr dev displays the extended attributes of the subdirectory named dev (not the file dev/dev). The directory attributes probably are not the cause of this problem.

If this is confusing, ls -lFR might help you see what's happening (the -R option recursively lists subdirectories).

Finally, if my suspicion is correct and you're really trying to add a private key identity file named ~/.ssh/dev/dev to the ssh authentication agent, try ssh-add dev/dev (or perhaps better, ssh-add ~/.ssh/dev/dev, which should work no matter the permissions of the enclosing directory.

  • This was not a sub-directory of ~/.ssh, it was a sub-directory of ~ that had the xattr set and causing the confusion. That fixed it. Thanks! – scott m gardner Apr 7 '15 at 17:21

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .