跨linux 服务器,远程ip文件共享 SSHFS

来源:互联网 发布:汽车行业数据查询 编辑:程序博客网 时间:2024/05/17 07:04


内网共享,我们可以用nfs实现文件共享,

对于远程,我们可以通过sshfs的方式进行文件远程共享

安装:

1. Enable the EPEL repo

yum install epel-release -y

2.Install FUSE and SSHFS packages

yum install fuse sshfs



 3. Load the FUSE module

modprobe fuse
结果:    fuse                   84368  2

4.开机启动:

 echo "modprobe fuse" >> /etc/rc.local

5 配置sshkey,可以无密码ssh远程


6.挂载

 sshfs user@remote_host:/remote_directory /local_mount_partition

将remote_host的remote_directory 挂载到本地的local_mount_partition文件夹下。


OK,

df -h  就可以看到了

root@173.144.41.2:/www/web/xxx.com/media                      916G  226G  644G  26% /testmount


如果 想在php  使用 nginx可以访问

必须这样

sshfs -o allow_other  root@173.192.41.2:/www/web/onfancy.com/media /www/web/erp/frontend/web/media

也就是在前面加一个   -o allow_other参数


0 0
原创粉丝点击