为 sshfs 挂载点设置适当的权限,以便它可以与 samba 共享

CS0*_*S01 17 ssh samba gentoo sshfs fstab

我有一个通过 SSH 提供访问的域托管服务商。

我的平台是:

  • Gentoo 2.6.36-r5
  • 视窗 (XP/Vista/7)

我在 Windows 上工作,我使用 Gentoo 来完成 Windows 无法完成的所有魔术。

因此,我使用 sshfs 将我的域的远程公共目录挂载到 /mnt/mydomain.com。身份验证是通过密钥完成的,所以懒惰的我不必时不时地输入我的密码。

由于我在 Windows 上进行编码,并且我不想一直上传/下载更改的文件,因此我想通过 samba 共享访问此 /mnt/mydomain.com。

所以我在 samba 中共享了 /mnt,除 mydomain.com 之外的所有挂载都列在我的 Windows 资源管理器中。

我的理论是:

  1. sshfs不会将挂载点 uid/gid 设置为samba期望的值
  2. samba不知道它必须包含/mnt/mydomain.com已设置的 uid/gid 。
  3. 以上都是错误的,我不知道。

这是控制台的配置和输出,需要任何其他信息,请告诉我。我也没有注意到与此问题相关的错误或警告,但我可能是错的。

gentoo ~ # ls -lah /mnt
total 20K
drwxr-xr-x  9 root  root  4.0K Mar 26 16:15 .
drwxr-xr-x 18 root  root  4.0K Mar 26  2011 ..
-rw-r--r--  1 root  root     0 Feb  1 16:12 .keep
drwxr-xr-x  1 root  root     0 Mar 18 12:09 buffer
drwxr-s--x  1 68591 68591 4.0K Feb 16 15:43 mydomain.com
drwx------  2 root  root  4.0K Feb  1 16:12 cdrom
drwx------  2 root  root  4.0K Feb  1 16:12 floppy
drwxr-xr-x  1 root  root     0 Sep  1  2009 services
drwxr-xr-x  1 root  root     0 Feb 10 15:08 www
Run Code Online (Sandbox Code Playgroud)

/etc/samba/smb.conf

[mnt]
comment = Mount points
writable = yes
writeable = yes
browseable = yes
browsable = yes
path = /mnt
Run Code Online (Sandbox Code Playgroud)

/etc/fstab

sshfs#myusername@mywebhotel.com:/home/to/pub/dir/ /mnt/mydomain.com/ fuse comment=sshfs,noauto,users,exec,uid=0,gid=0,allow_other,reconnect,follow_symlinks,transform_symlinks,idmap=none,SSHOPT=HostBasedAuthentication 0 0
Run Code Online (Sandbox Code Playgroud)

为了更容易阅读:

  • myusername@mywebhotel.com
  • /home/to/pub/dir/
  • /mnt/mydomain.com/

选项:

  • 评论=sshfs
  • 没有自动
  • 用户
  • 执行
  • 用户名=0
  • gid=0
  • 允许_其他
  • 重新连接
  • follow_symlinks
  • 变换符号链接
  • idmap=无
  • SSHOPT=基于主机的身份验证

帮助!

use*_*686 14

sshfs是一个基于 FUSE 的文件系统,出于安全考虑,FUSE 层默认不允许其他用户访问其挂载。您有allow_other选项,但它会被忽略,直到您还编辑/etc/fuse.conf以包含user_allow_other.

  • 您还需要通过选项 uid=<UID>,gid=<GID> 将 UID 和/或 GID 映射到您想要的用户。 (2认同)