sshfs file system over ssh
sources:
- https://www.digitalocean.com/community/tutorials/how-to-use-sshfs-to-mount-remote-file-systems-over-ssh
- https://unix.stackexchange.com/questions/519613/how-to-make-an-fstab-entry-for-sshfs-on-non-standard-ssh-port-and-using-ssh-key#519624
- https://askubuntu.com/questions/473648/auto-mount-sshfs-volume-through-fstab-with-password-auth/1220073#1220073
steps
create mount point
mkdir /mnt/EXTERNALSSHFS
mount point permissios and ownership
create a fuse group to add users to it
sudo groupadd fuse
sudo usermod -aG fuse YOURUSER
change group ownership
sudo chgrp fuse /mnt/EXTERNALSSHFS
sudo chmod g+w /mnt/EXTERNALSSHFS
mount over ssh
one time mount
sshfs -o default_permissions,IdentityFile=~/.ssh/id_sshkey,port=2222 user_at_server@your_server:/path/to/files /mnt/EXTERNALSSHFS/
Permanently mount
edit /etc/fstab with
user_at_server@your_server_ip:/path/to/files /mnt/EXTERNALSSHFS fuse.sshfs noauto,password_stdin,defaults,user,allow_other,reconnect,delay_connect,ConnectTimeout=5,ServerAliveInterval=5,IdentityFile=/root/.ssh/id_sshkey,port=22 0 0
add server to your .ssh/config
host your-remote-server
HostName 192.168.1.100 # your server ip
Port 22 # your server ssh port
User your_server_username
IdentityFile ~/.ssh/id_sshkey
then mount as
sshfs your-remote-server:/path/to/files /mnt/EXTERNALSSHFS
umount
umount /mnt/EXTERNALSSHFS