sshfs 远程服务器挂载

警告
本文最后更新于 2020-04-14,文中内容可能已过时。

在服务器上面挂载另外一台服务器磁盘,像读取本地文件一样使用远程服务器磁盘。

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
## https://unix.stackexchange.com/questions/37168/unable-to-use-o-allow-other-with-sshfs-option-enabled-in-fuse-conf

vim /etc/fuse.conf
# Set the maximum number of FUSE mounts allowed to non-root users.
# The default is 1000.
#
#mount_max = 1000

# Allow non-root users to specify the 'allow_other' or 'allow_root'
# mount options.
#
user_allow_other
chmod a+r /etc/fuse.conf

## ubuntu
sudo apt install sshfs
sudo apt install fuse

## CentOS
sudo yum install sshfs
sudo yum install fuse

##
cd /mnt
mkdir From135
chmod -R 777 /mnt/From135

##
sshfs trader@192.168.1.135:/ /mnt/From135 -o port=22,compression=yes,reconnect,idmap=user,allow_other -o ro

alias mount.135='sshfs trader@192.168.1.135:/data /mnt/From135 -o reconnect,idmap=user,allow_other -o ro'
alias unmount.135='fusermount -u /mnt/From135 && umount -l /mnt/From135'

相关内容

william 支付宝支付宝
william 微信微信
0%