sshfs file system over ssh - Howto's | vitrubio.net

sshfs file system over ssh

sources:

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