如何将不同 PC 上的 Linux 目录挂载到本地 Linux PC?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/232269/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-03 16:38:48  来源:igfitidea点击:

How to Mount a Linux directory from a different PC to your local Linux PC?

linuxmountnfs

提问by ksuralta

Is there a way to mount a Linux directory from a different PC to your local Linux PC? How?

有没有办法将 Linux 目录从不同的 PC 挂载到本地 Linux PC?如何?

采纳答案by Robert Gamble

Yes, it's called NFS. You might also want to check out sshfswhich is pretty nice.

是的,它被称为NFS。您可能还想查看非常不错的sshfs

回答by ksuralta

You need to be a bit more specific. You can use NFS.

你需要更具体一点。您可以使用 NFS。

Depending on what distro you're using, you simply edit the /etc/exports file on the remote machine to export the directories you want, then start your NFS daemon.

根据您使用的发行版,您只需编辑远程机器上的 /etc/exports 文件以导出您想要的目录,然后启动您的 NFS 守护程序。

Then on the local PC, you mount it using the following command:

然后在本地 PC 上,使用以下命令挂载它:

mount -t nfs {remote_pc_address}:/remote/dir /some/local/dir

mount -t nfs {remote_pc_address}:/remote/dir /some/local/dir

Use the manutility for more information:

使用man实用程序了解更多信息:

man exports(Examples of configuring directories for export are on the bottom of this manual page.)

man 导出(配置导出目录的示例位于本手册页的底部。)

回答by Georg Zimmer

sshfs is very nice, and easy to use

sshfs 非常好,而且易于使用

sshfs user@remotesystem:/remote/dir /some/local/dir

sshfs user@remotesystem:/remote/dir /some/local/dir

回答by Ignacio Vazquez-Abrams

NFS is handy since it's built-in and easy to configure, but the 2 common implementations (NFSv2 and NFSv3) don't translate usernames between the systems; user IDs are used instead. This requires you to use a central auth system such as LDAP so tha tcommon user IDs can be maintained.

NFS 很方便,因为它是内置的且易于配置,但 2 个常见的实现(NFSv2 和 NFSv3)不会在系统之间转换用户名;而是使用用户 ID。这要求您使用中央身份验证系统(例如 LDAP),以便可以维护公共用户 ID。

sshfs requires you to connect as a single user and so accesses are always done (and consequently, can only be done) as that user.

sshfs 要求您以单个用户身份进行连接,因此始终以该用户身份进行访问(因此只能进行)。

cifs in a * nix-to-* nix connection (via Samba) both translates usernames andfollows standard *nix permissions. As well, it is more flexible in that it allows you to perform ownership/permission transformation on creation of a new file or directory. It is, however, much more complex to configure.

* nix-to-* nix 连接(通过 Samba)中的 cifs 既转换用户名遵循标准的 *nix 权限。同样,它更灵活,因为它允许您在创建新文件或目录时执行所有权/权限转换。但是,配置要复杂得多。

回答by akshaypmurgod

sshfs works pretty well for me.

sshfs 对我来说效果很好。

sudo sshfs -o allow_other [email protected]:/directory local_directory

须藤 sshfs -o allow_other [email protected]:/directory local_directory

remote machine ip : 1.2.3.4

远程机器ip:1.2.3.4