I keep an SSH private key file on a separate USB thumb drive (encrypted), but when I try to use it to connect to my remote host I get an error:

@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
@         WARNING: UNPROTECTED PRIVATE KEY FILE!          @
@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@
Permissions 0777 for '/Volumes/USB/id_rsa' are too open.
It is recommended that your private key files are NOT accessible by others.
This private key will be ignored.
bad permissions: ignore key: /Volumes/USB/id_rsa
Permission denied (publickey).

I've tried changing the permissions on the keyfile (chmod 600 id_rsa), but it still looks to be set to 777 (change not taking effect). This is on Mac OS X.

Any idea how to fix it?

link|improve this question
feedback

migrated from stackoverflow.com May 24 '11 at 2:27

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

4 Answers

up vote 1 down vote accepted

What type of filesystem do you have on your USB stick? If it is one of the FAT filesystems, FAT8, FAT16, VFAT, FAT32, then you're probably out of luck, as they do not have fields to store Unix-style permission bits. (The UMSDOS filesystem driver for Linux does hack this up, but I doubt OS X has anything that hacky available. :)

If it is NTFS or NTFS2, then perhaps there can be some mapping made, but I wouldn't count on it.

If it is HFS+ or UFS, then definitely more details are needed, because it ought to work as you've described, but symlinks could get in the way.

link|improve this answer
feedback

Your flash drive is probably pre-formatted to FAT32, which does not support Unix-style permissions. Reformat your flash drive to a better file system (HFS+ comes to mind, since you're on Mac).

link|improve this answer
feedback

I think chmod 600 /Volumes/USB/id_rsa is sufficient.

link|improve this answer
feedback

You should not use 777 for ssh keys - you're supposed to use 700. Keys must not be accessible by others.

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.