简体   繁体   中英

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

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.

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM