主要因為要在筆電上做檔案分享,網路環境會換來換去,所以不考慮 samba 或 NFS,而且 sshfs 還不用在 server 上做任何設定,還蠻符合需求的。
Ubuntu
安裝就不提了,指令如下:
sshfs wildfootw@wildfoo.tw:/home/wildfootw/Workplace/data ~/Workplace/data -o port=29777,reconnect,ServerAliveInterval=15,ServerAliveCountMax=3,uid=1000,gid=1000,IdentityFile=/home/wildfootw/.ssh/wildfootw@wildfoo.tw
在 /etc/fstab 中的設定
sshfs#wildfootw@wildfoo.tw:/home/wildfootw/Workplace/data /home/wildfootw/Workplace/data fuse defaults,_netdev,allow_other,reconnect,ServerAliveInterval=15,ServerAliveCountMax=3,uid=1000,gid=1000,port=29777,IdentityFile=/home/wildfootw/.ssh/wildfootw@wildfoo.tw 0 0
如果沒有成功的話可以加入 -o debug,sshfs_debug,loglevel=debug (如果是 fstab , 直接加在參數們中間) , 並用 sudo mount -a 除錯,有時候還會叫你加入信任的主機,或是重灌 server 後發現 host identification has changed 之類的
stackexchange – how-to-make-an-fstab-entry-for-sshfs-on-non-standard-ssh-port-and-using-ssh-key
askubuntu.com sshfs-is-mounting-filesystems-as-another-user
Windows

\\sshfs\wildfootw@wildfoo.tw!29777\Workplace\data \\sshfs\[LOCUSER=]REMUSER@HOST[!PORT][\PATH] # root - /home/REMUSER \\sshfs.r\[LOCUSER=]REMUSER@HOST[!PORT][\PATH] # root - /
issue
linux 下 ls 卡住 : ServerAliveInterval=15,ServerAliveCountMax=3
sshfs-win 在 windows 更新後無法連線至 sshfs