欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  科技

Linux/Mac 挂载远程服务器目录到本地

程序员文章站 2022-03-28 15:19:29
1. 安装 2. 创建SSHFS 挂载目录 3.使用SSHFS 挂载远程的文件系统 sudo sshfs -o allow_other,IdentityFile=~/.ssh/id_rsa #username@site:/share1/home/siyuan /mnt/siyuan 例: sshfs ......

1. 安装

sudo apt-get installsshfs

 

2. 创建sshfs 挂载目录

sudo mkdir/mnt/siyuan

 

3.使用sshfs 挂载远程的文件系统

sudo sshfs -o allow_other,identityfile=~/.ssh/id_rsa #username@site:/share1/home/siyuan /mnt/siyuan

例:

sudo sshfs -o allow_other,identityfile=~/.ssh/id_rsa siyuan@uestc.site:/share1/home/siyuan  /mnt/siyuan

sshfs -c -o reconnect #username@site:/share1/home/siyuan ~/mnt/siyuan

例:

sshfs -c -o reconnect siyuan@uestc.site:/share1/home/siyuan ~/mnt/siyuan

 

4. 卸载远程的文件系统

sudo umount/mnt/siyuan