Impostare Sshfs in Fstab

Per montare una cartella di un server, in modo automatico, impostare /etc/fstab come segue:

sshfs#root@192.168.1.1:/home/  /mnt/server    fuse    comment=sshfs,users,noauto,uid=1000,gid=1000,allow_other,reconnect,transform_symlinks 0 0

Così facendo sarà possibile montare la cartella con il semplice comando:

mount /mnt/server

Ne qual caso vi chiederà la password di root (o dell’utente impostato per l’accesso).
Per evitare che chieda la password di autentificazione, posizionarsi nel client e digitare il seguente comando:

ssh-keygen -t dsa

il quale creerà i file /home/utente/.ssh/id_dsa e /home/utente/.ssh/id_dsa.pub
A questo punto montare manualmente il server con:

sshfs root@192.168.1.1:/home/utente /mnt/server/

e creare il file authorized_keys con il comando:

cat /home/utente/.ssh/id_dsa.pub > /mnt/server/.ssh/authorized_keys

Comments are closed.