使用 SSHFS 挂载远程文件系统

发布于 2024-07-27 13:53:59 字数 1923 浏览 3 评论 0原文

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

痴情换悲伤 2024-08-03 13:53:59

您可以创建一个脚本来拦截对远程计算机上 sftp 子系统的调用。 将以下脚本放在远程服务器上的某个位置,比如说 /root/bin/sftp_intercept:

#!/bin/sh
exec sudo -u less_privileged_user /usr/lib/openssh/sftp-server

然后像这样进行调用:

sshfs root@remote:dir mountpoint -o sftp_server=/root/bin/sftp_intercept

然后应该会给出所需的结果。

您需要一个适当的 sudoers 条目才能使 sudo 工作而不提示输入密码,并且不要忘记“chmod 755 ~/bin/sftp_intercept”。

另外,请确保 /usr/lib/openssh/sftp-server 确实是 sftp-server 的路径。 如果不是,则可能是 /usr/lib/sftp-server。

You can create a script to intercept the call to the sftp subsystem on the remote machine. Put the following script somewhere on the remote server, let's say /root/bin/sftp_intercept:

#!/bin/sh
exec sudo -u less_privileged_user /usr/lib/openssh/sftp-server

and then make the call like so:

sshfs root@remote:dir mountpoint -o sftp_server=/root/bin/sftp_intercept

That should then give the desired results.

You'll need an apropriate sudoers entry to make sudo work without it prompting for a password, and don't forget to "chmod 755 ~/bin/sftp_intercept".

Also, make sure that /usr/lib/openssh/sftp-server is indeed the path to the sftp-server. If not, then perhaps it is /usr/lib/sftp-server.

反话 2024-08-03 13:53:59

sshfs 手册页建议传递

-o uid=$YOURUID -o gid=$YOURGID

给 sshfs 调用时应将您创建的文件的用户/组设置为该 uid/gid。 显然,您需要在远程系统上找到这些。

The sshfs manpage suggests that passing

-o uid=$YOURUID -o gid=$YOURGID

to your sshfs invocation should set the user/group of the files you create to that uid/gid. You'll need to find these on the remote system, obviously.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文