1. 安装 sshfs
Debian系
sudo apt-get install sshfs
Arch系
sudo pacman -S sshfs
Fedore上安装
yum install fuse-sshfs
CentOS上安装
方法1:yum安装
默认源无该工具,需要先安装EPEL源
yum install -y epel-release
yum -y install fuse-sshfs
yum list fs-sshfs
方法2:下载rpm安装
下载rpm文件for Centos7:
wget http://ftp.tu-chemnitz.de/pub/linux/dag/redhat/el7/en/x86_64/rpmforge/RPMS/fuse-sshfs-2.5-1.el7.rf.x86_64.rpm
方法3:编译安装
下载:https://github.com/libfuse/sshfs/releases
tar xvf sshfs-3.2.0.tar.gz
./configure --prefix=/usr/local/sshfs
make
make install
2. 挂载远程目录到本地
sshfs user@hostIP:path [MountDir]
例如:
sshfs admin@192.168.110.102:/home/admin /mnt/admin
这样就把远程目录/home/admin挂载到了本地的 /mnt/admin下
3. 卸载
fusermount -u /mnt/admin
或
umount /mnt/admin