开发者

sshfs with different gid on remote

开发者 https://www.devze.com 2023-01-01 01:50 出处:网络
I don\'t know how to mount a remote directory \"remote_dir\" on computer \"remote\", having remote gid \"wgrp\".

I don't know how to mount a remote directory "remote_dir" on computer "remote", having remote gid "wgrp". Help is welcome.

  me@local$ sshfs me@remote:/remote_dir remote_as_wgrp ...wanted_options...

A workaround is to create a new user "me_wgrp" belonging to group "wgrp". But the problem seems conceptually so simple that I'm sure there is a solution.

Context:

I'm able to connect using ssh on remote compute, and then to change my gid:

  me@local$ ssh me@remote
  me@remote$ newgrp wgrp

Now I can create files in directories which are only writable by the开发者_JAVA百科 group "wgrp".

I have tried

  sshfs me@remote:/remote_dir remote_as_wgrp -o ssh_command='newgrp wgrp'

but sshfs seems blocked.

Also, if I try

  ssh me@remote 'newgrp wgrp'

ssh doesn't give the prompt, but it accepts commands.


You should consider changing the default group on the remote host has newgrp will never return because it opens a new shell. "newgrp - return you to a prompt of a new shell."


unfortunately it looks like newgrp group, or "newgrp group -" causes sshfs to not work in the newgrp environment. You won't be able to cd into the sshfs directory or ls, basically you'll get a permission denied error (and it's not due to permissions issues). You'll also notice that df no longer shows the sshfs fuse mount.


Ten years after the question was asked, I needed this myself.

I found that it is now possible to add a parameter to sshfs:

sshfs -o sftp_server="sg <group> -c '/usr/lib/misc/sftp-server -u <umask>'" ...

where /usr/lib/misc/sftp-server is the location of sftp-server on the remote system, <group> is the desired group on the remote system, and -u <umask> is an optional way of providing a default umask for the particular sftp-server.

0

精彩评论

暂无评论...
验证码 换一张
取 消