From another SO question, I understand I should create an entry in fstab to permanently mount an access to a virtual machine.
I am not Linux expert. The magic command which allows me to perform this from a terminal is:
sudo sshfs -o idmap=user -o allow_other -o nonempty jverstrynge@devjverstrynge:/home/httpd /home/jverstrynge/httpdWhen I check the above SO question, I see an entry looking like this:
/media/mybook/laptop_backup /export/laptop_backup none bind 0 0Can someone explain how to transform the CLI command into an entry in fstab?
3 Answers
You can use this syntax:
sshfs#USER@HOST:REMOTE_PATH LOCAL_PATH fuse defaults,allow_other 0 0E.g.
sshfs#jverstrynge@devjverstrynge:/home/httpd /home/jverstrynge/httpd fuse defaults,allow_other 0 0But this works only if you use ssh keys for authentication.
3this works for non systemd,see article for other config (Fedora, Arch, openSuse,...)
USERNAME@HOSTNAME_OR_IP:/REMOTE/DIRECTORY /LOCAL/MOUNTPOINT fuse.sshfs _netdev,user,idmap=user,transform_symlinks,identityfile=/home/USERNAME/.ssh/id_rsa,allow_other,default_permissions,uid=USER_ID_N,gid=USER_GID_N 0 0a systemd distro (Arch, Fedora, OpenSUSE,...), the suitable instruction is:
USERNAME@HOSTNAME_OR_IP:/REMOTE/DIRECTORY /LOCAL/MOUNTPOINT fuse.sshfs x-systemd.automount,_netdev,user,idmap=user,transform_symlinks,identityfile=/home/USERNAME/.ssh/id_rsa,allow_other,default_permissions,uid=USER_ID_N,gid=USER_GID_N 0 0 4 Try autofs
create auto.master:
/mount /etc/auto.sshfs uid=1000,gid=1000,--timeout=30,--ghostcreate auto.sshfs - moviefolder:
fstype=fuse,rw,allow_other,noatime,port=54321,IdentityFile=/root/.ssh/id_rsa :sshfs\#root@10.70.70.12\:/var/www/html/moviefolderYou need to have ssh keys for this to work.
0