sshfs / autofs
https://linux.die.net/man/1/sshfs
command line
- sshfs -p 1234 user@10.10.46.119: /mnt
fstab
-
vi /etc/fstab
-
sshfs#myuser@myserver.example.com:/mydir /mount/myserver fuse defaults,noatime,port=2222 0 0
-
Disconnect stalled sshfs mount
- fusermount -uz /mnt
autofs
https://linux.die.net/man/1/sshfs
For root user, we assume you already have exchanged ssh keys with the target system
- apt-get install sshfs autofs
-
mkdir /autofs
- Thats the target dir for out mount points, name it as you like
-
vi /etc/auto.master
-
/autofs /etc/auto.sshfs --timeout=60
- Umount after 60 seconds
-
-
vi /etc/auto.sshfs
-
localdir -fstype=fuse,port=2222 :sshfs\#myuser@myserver.example.com\:/targetdir
- non standard port 2222
- ":" and "#" have special meanings in that file -> escape
-
- service autofs restart
-
ls -l /autofs/localdir
- Access to our autofs directory mounts it automatically.
- Note that the directory is'nt there when not mounted! (confusing!)
Troubleshooting
- service autofs status
- tail /var/log/syslog