Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

I am trying to mount private keys from USB stick. OSx does not allow me to change their permissions, why? How can I change them? In other words, how can I add private keys from random USB stick to ssh-agent?

enter image description here

share|improve this question
    
Can you run an ls -l on school to show it's current perms? In addition to the file itself, SSH gets grumpy if the permissions on the directory they're in are open. Make sure that .ssh has restrictive perms, I think 600 is good, from memory. –  Alex Nov 16 '12 at 1:09
    
...err execute permission is too much. Read permission is enough i.e. 400. You can see the current perms in the picture i.e. 777 -- OSx automounts the USB to everyone apparently in the system, now trying to find a way to do it without copying files to the disk. Please, see my answer for a way to solve it, not the safest method but works. –  hhh Nov 16 '12 at 1:13
    
You need execute on a directory to see what it's contents are. –  Alex Nov 16 '12 at 1:55
add comment

2 Answers

up vote 5 down vote accepted

I'll bet your USB stick is formatted as FAT, FAT32 or NTFS. OS X's Unix-style permissions are not compatible with FAT and FAT32 filesystems. Additionally, by default, OS X cannot write to NTFS volumes. Make sure the USB stick is formatted as HFS+.

And finally, the file containing the SSH private key must have permissions set to 600 and the folder containing the file must have permissions set to 700

share|improve this answer
    
Why 600 and not 400? They need just read -access, where do you need write access for files? Any idea how can I create OS X -style fs with non-mac -devices? This is going be a problem if I use many systems. –  hhh Nov 16 '12 at 21:22
1  
You can try 400 instead of 600. I suggested 600 because that's what I have on my system. ... To make your USB stick a "Mac device" just format it using Disk Utility.app. –  HairOfTheDog Nov 16 '12 at 22:38
add comment

You can solve this problem with

$ cp /Volumes/disk/.ssh ~
$ eval `ssh-agent`
$ chmod 400 ~/.ssh/*
$ ssh-add ~/.ssh/school

but this does not solve the original prob i.e. without copying ssh-keys to computer to add keys to the daemon

share|improve this answer
1  
This worked for me: sudo chmod 600 ~/.ssh/id_rsa –  Andrew Hundt Dec 14 '12 at 18:34
add comment

Your Answer

 
discard

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

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