首页 > 其他分享 >远程挂载sftp

远程挂载sftp

时间:2023-02-08 15:23:18浏览次数:33  
标签:sftpuser 10.10 远程 testly 挂载 sftp 2.6

1.A机器上启用sftp,编辑 /etc/ssh/sshd_config

Subsystem        sftp        internal-sftp
Ciphers aes256-ctr,aes192-ctr,aes128-ctr
Match Group sftp
        ChrootDirectory /data1/sftpfile
        ForceCommand internal-sftp
        AllowTcpForwarding no
        X11Forwarding no

将用户sftpuser加入到sftp组中,赋予用户sftpuser和组sftp /data1/sftpfile目录权限

2.B机器上使用sshfs挂载A机器上的sftp

sshfs -p 22 [email protected]:/ /testly  #将10.10.2.6上的sftp根目录挂载到 /testly上

卸载:umount /testly

3.开机自动挂载:

vim mountsftp.sh

echo sftppassword | /usr/bin/sshfs -p [email protected]:/ /testly -o reconnect -o cache=yes -o allow_other -o nonempty -o password_stdin

 

标签:sftpuser,10.10,远程,testly,挂载,sftp,2.6
From: https://www.cnblogs.com/dreamer-fish/p/17101882.html

相关文章