sshFS的特点: 基于FUSE(linux的最佳用户空间文件系统框架) 多线程:在服务器上可以有多个请求 允许大读取(最大64k) 缓存目录内容 步骤1:安装fuse-sshfs 对于Centos/rhel用户,fus
sshFS的特点:
允许大读取(最大64k)
缓存目录内容
步骤1:安装fuse-sshfs
对于Centos/rhel用户,fuse sshfs在epel repository下可用,因此请确保在系统中安装了epel repository。现在执行以下命令安装它
在CENTOS/RHELL上:
#yum install fuse-sshfs
在UbuntyIuQgwu和Dabian上:
$ sudo apt-get update
$ sudo apt-get install sshfs
步骤2:装载远程目录
让我们使用sshfs挂载远程服务器目录,确保远程系统运行的ssh服务器与系统的ssh连接正确。
首先创建装入点
# mkdir /mntssh
让我们挂载远程目录。对于本例,我们将把/home/remoteuser目录从192.168.1.12(remote.example.com)系统安装到本地系统。
# sshfs laitkor@remote.example.com:/home/remoteuser /opt/mntssh
样本输出
The authenticity of host 'remote.example.com (192.168.1.12)' can't be established.
RSA key fingerprint is 77:85:9e:ff:de:2a:ef:49:68:09:9b:dc:f0:f3:09:07.
Are you sure you want to continue connecting (yes/no)? yes
remoteuser@remote.example.com's passWord:
步骤3:验证安装
在本地挂载点上挂载远程文件系统后,通过运行mount命令进行验证。
# mount
/dev/mapper/vg_svr1-lv_root on / type ext4 (rw)
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
devpts on /dev/pts type devpts (rw,gid=5,mode=620)
tmpfs on /dev/shm type tmpfs (rw)
/dev/sda1 on /boot type ext4 (rw)remoteuser@remote.example.com:/home/remoteuser on /mntssh type fuse.sshfs (rw,nosuid,nodev)
同样导航到你的挂载点,将从远程系统中看到文件
# cd /mntssh
# ls
步骤4:在系统引导时挂载目录
如果要在每次系统重新引导时自动挂载远程文件系统,请在/ etc / fstab文件中添加以下条目。确保在远程和本地系统之间安装了基于密钥的ssh。
remoteuser@remote.example.com:/home/remoteuser /mntssh fuse.sshfs defaults 0 0
步骤5:卸载目录
如果您的工作结束并且您不再需要已安装的目录,则只需使用以下命令卸载。
#umount / mntssh
--结束END--
本文标题: Linux上通过SSH挂载远程文件系统方法详解
本文链接: https://www.lsjlt.com/news/20200.html(转载时请注明来源链接)
有问题或投稿请发送至: 邮箱/279061341@qq.com QQ/279061341
下载Word文档到电脑,方便收藏和打印~
2024-03-01
2024-03-01
2024-03-01
2024-03-01
2024-03-01
2024-02-29
2024-02-29
2024-02-29
2024-02-29
2024-02-29
回答
回答
回答
回答
回答
回答
回答
回答
回答
回答
0