Linux下sshfs示例

//A端系統 ip:192.168.56.10 user:admin dir:/mnt/test
# cat /etc/redhat-release 
CentOS Linux release 7.6.1810 (Core)
# uname -r
3.10.0-957.5.1.el7.x86_64

//B端系統 ip:192.168.56.20 user:admin dir:/mnt/test
# cat /etc/redhat-release 
CentOS release 6.9 (Final)
# uname -r
2.6.32-696.el6.x86_64
//A端操作
# yum -y install sshfs
//安裝包之後需要進行 Linux下ssh單向免密登陸/互免密登陸 參考:https://blog.csdn.net/qq_35590198/article/details/87360081 ,用於開機掛載目錄
//掛載命令1
# sshfs -o allow_other,transform_symlinks -o IdentityFile=/home/user/admin/.ssh/id_rsa [email protected]:/mnt/test /mnt/test
//-o allow_other 這個參數是必要的,否則可能會出現權限不夠的問題
//如果有 ln 鏈接之類的,還需要加上 transform_symlinks 參數
//-o IdentityFile 指定sshkey,實現免密掛載

//或 掛載命令2
# sshfs -o allow_other,transform_symlinks [email protected]:/mnt/test /mnt/test
//驗證
# df -hT

//解除掛載
# fusermount -u /mnt/test

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章