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?
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
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
As late as OS X 10.13/High Sierra, you can add an
/etc/fstab file owned by root, even if it doesn't exist on your system, with the following content:
LABEL=PRIVATE none msdos -u=501,-m=700
This assumes that your user ID is 501 (check with
ls -n ~) and that the label of your mounted FAT/ExFAT drive is
PRIVATE. I use this for mounting VeraCrypt volume-files with ssh keys (FAT and ExFAT) that I share b/w OS X and Linux. Should work with USB drives as well, but haven't tried exactly that.