安装
brew cask install osxfuse
brew install sshfs
sudo chown ${whoami} /usr/local/share/man/man1
brew link sshfs
挂载
sshfs username@server:path local_path
取消挂载
umount mount_path
这样子每次挂载的时候,都需要输入密码,可以设置成免密码登录: cat .ssh/id_rsa.pub | ssh username@server "cat - >>.ssh/authorized_keys" 将公钥追加到远程服务器:
cat .ssh/id_rsa.pub | ssh username@server "cat - >>.ssh/authorized_keys"
sshfs username@server:path local_path
umount mount_path
其他: 当发现再次进入目录报错,或者取消挂载umount dir失败时,需要杀掉相应进程: pgrep -lf sshfs pkill -9 sshfs 之后重新挂载。
文/shanshanfei(简书作者)
原文链接:http://www.jianshu.com/p/31205b26deff
著作权归作者所有,转载请联系作者获得授权,并标注“简书作者”。