通过 SSH 把远端目录挂载到本地
sshfs 基于 SFTP/FUSE,把远端目录映射成本地文件系统。适合临时访问、编辑远端文件,不适合高并发/低延迟要求的场景。
sshfs user@host:/remote/path /mnt/remote
sshfs -o reconnect -o ServerAliveInterval=15 user@host:/data /mnt/data
sshfs -o IdentityFile=~/.ssh/id_ed25519 -p 2222 user@host:/data /mnt/data
fusermount -u /mnt/data
allow_other 需要 /etc/fuse.conf 开启 user_allow_other,且影响其他用户访问。-o reconnect 和 keepalive,必要时 fusermount -uz。-o uid=/-o gid= 或 idmap。fusermount -u,不要直接 umount;忙时先找占用进程。合上页面,先回答,再展开对照。
umount?allow_other 需要满足什么前提?fusermount -u;忙时先找占用进程,必要时用 fusermount -uz 强制卸载。/etc/fuse.conf 中开启 user_allow_other,并且它会影响其他用户的访问。-o reconnect 和 keepalive(如 -o ServerAliveInterval=15),必要时用 fusermount -uz。
小程序版
微信扫码,随时查命令