返回> 网站首页 

两个ubuntu共享文件夹拷贝文件 - sshfs挂载远程linux目录

yoours2024-05-08 20:37:22 阅读 470

简介一边听听音乐,一边写写文章。

一、介绍

    SSHFS(Secure SHell FileSystem)是一个可以通过 SSH 文件传输协议(SFTP)挂载远程的文件系统并且在本地机器上和远程的目录和文件进行交互。

二、安装

    sudo apt install sshfs

三、挂载远程linux文件夹

    本地创建一个空文件夹用于挂载

    sshfs soskp@192.168.232.129:/home/soskp/ /root/local_folder

四、常用参数说明

    -o allow_other         allow access to other users

    如果不指定本参数,则只有挂载本文件系统的用户才可以访问;如果指定本参数,则允许系统中的其他用户访问;

    -o reconnect           reconnect to server

    断链后,会自动重连远程服务器,对于网络不太稳定的环境比较有用;

    -o ro

    挂载后,文件内容为只读

    -o cache_timeout=N     sets timeout for caches in seconds (default: 20)

    N是整数,指定缓存的超时时间,以秒为单位;

    -o follow_symlinks     follow symlinks on the server

    跟踪符号链接,可以让sshfs在文件系统中跟踪访问符号链接对应的文件;

    -p PORT                equivalent to '-o port=PORT'

    -o port=PORT

    指定远程服务器的ssh端口号

    例如:

    sshfs -o allow_other,reconnect  soskp@192.168.232.129:/home/soskp/ /root/local_folder

五、卸载

    umount /root/local_folder

    fusermount -u /root/local_folder


微信小程序扫码登陆

文章评论

470人参与,0条评论