SSH Permissions – How to Bypass SSH Key File Permission Check

permissionsprivate-keyssh

I have an encrypted FAT volume (for compatibility) containing a private key file and other sensitive data.

I want to connect to my server through SSH using my private key, but of course, as FAT doesn't support file permission, it ignores my key saying its permissions are too open.

So currently I'm copying it somewhere else on my hard drive with 0600 permissions, using it and then securely erasing it, but it's a pain.

Is there a way to bypass permission check on this very ssh/scp command line ?

Edit: Precision: it was a TrueCrypt volume on OS X.

On the solution: The accepted answer below solved my problem (using a SSH key file located on a TrueCrypt volume with Mac OS X), but it is a workaround. Looks like there is no way to "bypasssh key file permission check".

Best Answer

AFAIK, there is no way to bypass the keyfile permission check with ssh or ssh-add (and you can't trick it with named pipe or such). Besides, you do not actually want to trick ssh, but just to be able to use your key files.

Indeed, TrueCrypt volume is supposed to keep your data private, so mounting the volumes as world-readable (default behaviour of TrueCrypt) is not really optimum. If you're using a FAT-formatted volume, you really should ajust the mount options, as Dan Carley suggested.

Although mount options aren't yet correctly supported by TrueCrypt for OS X (even if you launch TC using the command line interface and the mount options from the man page - already tried), OS X does support mount option defaults based on the volume name.

You need to know your user id (usually 501 if you are the first/only user of the computer). You can get it with "id -u".

Let' say you volume name is "PRIVATE" (volume names are in capitals), and your uid is 501, all you have to do is adding this line to /etc/fstab :

LABEL=PRIVATE none msdos -u=501,-m=700

You need to be root to create/edit this file (it is not present in default OSX install) :

sudo vim /etc/fstab

Next time you mount the volume, it'll have permission 700 and owner id 501.

This also works with USB drives (which are usually formatted in FAT, too).