通过 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;忙时先找占用进程。