Mounting msdos USB with permissions on OSX
20 Nov 2015 in TIL
This was a fun one. I have my SSH keys on an external disk, but OSX insisted on mounting it as 0777 which meant that SSH didn't want to read my keys. I couldn't use umask
to change the mount permissions as it's an msdos
USB stick.
Thanks to a combination of symlinks and bindfs
, I have it working now.
How to fix:
bash
# Install bindfsbrew install homebrew/fuse/bindfs# Write aliases to mount/unmount (in .zshrc for me)unlock () {bindfs -n -p 0700 -u $(id -u) -g $(id -g) /Volumes/DATASHUR ~/lockboxecho "Unlocked"}lock () {umount ~/lockboxecho "Locked"}# Mount the fsunlock# Create my symlinksln -s /Users/michael/lockbox/keys/ssh .sshln -s /Users/michael/lockbox/keys/ssh/.ssh-ident .ssh-ident# Now it works!$ sshLoading keys:/Users/michael/.ssh/identities/personal/id_rsaEnter passphrase for /Users/michael/.ssh/identities/personal/id_rsa: