如何挂载远程(通过 SSH)目录以使其像本地目录一样可用(包括在 shell 中,而不仅仅是在 Gnome 中)?

Iva*_*van 10 ssh filesystem mount remote-access file-sharing

我将我的文件(主要是文本/代码,没有像视频等那么重的文件)放在远程服务器上的一个目录中,我只能通过 SSH 访问该目录。我可以将它安装在我的笔记本电脑上以从所有应用程序(包括命令行应用程序)无缝使用它吗?

Nic*_*cci 13

是的,确实可以!它被称为 sshfs。这是一个小教程。

基本思想是:

  1. 安装 sshfs

    sudo apt install sshfs
    
    Run Code Online (Sandbox Code Playgroud)
  2. 挂载远程目录

    sshfs user@host:/path/to/remote /path/to/local/mount/point
    
    Run Code Online (Sandbox Code Playgroud)

您现在/path/to/remote可以在/path/to/local/mount/point.