- 安装sshfs包
$ # if your system is just the 'centos', you just need to run yum $ sudo yum install -y sshfs
- 将用户增加到fuse组
$ # If the current user is not in fuse, when we try to mount, you would meet 'permission' error. $ # If the 'fuse' group does not exist, we need to create one group 'fuse' and then add $ sudo usermod -a -G fuse wlin usermod: group 'fuse' does not exist $ sudo groupadd fuse $ sudo usermod -a -G fuse wlin
- 实施挂载
$ # The 'mountpoint' can be anywhere not just under /mnt dir $ # Now let me mount one remote file to the local dir $ mkdir ROR_Blog_testing $ cd ROR_Blog_testing $ sshfs wlin@10.66.137.45:/home/wlin/ROR_Blog .
-
停止挂载
$ unmount ROR_Blog_testing
-
若希望启动自动挂载
$ # Make sure you can ssh the remote host without passwords. If you cannot, try the following steps $ ssh-keygen -t rsa $ ssh-copy-id -i ~/.ssh/id_rsa.pub wlin@10.66.136.45 $ # After you can ssh the remote host without passwords, you can edit the fstab as follows $ # make sure the mount point is one persistent file system $ sshfs#wlin@10.66.136.45:/home/users /root/sshfsExample fuse defaults 0 0 $ I have not tried it hope the above commands work well
使用SSHFS挂载远端目录
最新推荐文章于 2025-03-10 10:04:35 发布