How to use ssh keys for sshfs automount from mac to ubuntu

3.3k views Asked by At

I want to be able to automount an ubuntu volume on my mac using sshfs. I tried using ssh key-gen and copying the id_rsa file, adding the pub key to my authorized keys, using all sorts of sshfs -o options, to no avail.

1

There are 1 answers

0
Joshua Jackson On

The procedure for setting up ssh key authentication is the same whether you are using it for sshfs or something else.

On the client side you generate a key. In this case we are making a DSA key

ssh-keygen -t dsa

You should now have an id_dsa file and an id_dsa.pub file in your .ssh directory. The pub file is your public key, and its contents get placed inside the authorized_keys file (or authorized_keys2 if you are using a DSA key as above) in the .ssh directory of the server to which you want to log in.

If you are on a Linux client, you can probably push the key to the server using the ssh-copy-id command.

ssh-copy-id user@server:

On the client side the id_dsa file needs to be owned by you and have 600 permissions, which is the default when you generate the key. On the server side the authorized_keys file needs to be owned by you and not be world writable, which should be the case if you don't do anything weird when copying it over like doing that as root.