4

I've started creating dynamic sshfs mounts to other devices on my local network, but the equivalent users which are the same, have different UIDs/GIDs.

From what I've found whilst searching for a solution I need to add -o idmap=file -o uidfile=/mnt/pcfixe_uid_file -o gidfile=/mnt/pcfixe_gid_file to force how the mount should be owned.

What I can't do, is find out what one of these files is or how it is formatted. Can someone provide an example or point to an appropriate resource that does so.

For example, the device that I am running SSHFS on is UID=1000,GID=1000. The device to which I'm connecting is UID=1001,GID=1007. How do I 'send' the 1001/1007 so it owns the share on the other device's side.

BACKGROUND: I have several small (Raspberry Pi) transmission servers, I move any files under Torrents not in Complete, Incomplete or Incoming, into Complete. This happens on the Transmission server. I then connect to each of the Transmission servers from a main file server to pull all files from Torrents/Complete to a central repository.

As the equivalent users across the servers do not have matching uids/gids I need to be able to force them to be/appear to be a specific uid/gid depending on which server I'm pulling from.

6
  • There may be better options than SSHFS. (Not necessarily, but possibly.) Would you want to consider those? May 20, 2018 at 21:12
  • Totally, my overall goal is to dynamically create a link to other devices and then perform various commands, incl. RSync on various locations on the remote device. May 20, 2018 at 21:20
  • Your comment sounds like marketing-speak. By the way, rsync across sshfs will be desperately inefficient. May 20, 2018 at 21:47
  • rsync already operates over ssh natively. May 20, 2018 at 21:49
  • Exactly right, @IgnacioVazquez-Abrams. But I've seen people try it... May 20, 2018 at 21:50

1 Answer 1

4

The format of the uid and gid mapping files seems to consist of lines of the form: name:id where name is a user/group name on the client and id is a uid/gid on the server - e.g. graham:1002.

If you want several local users to be able to access the mount then you have to make sure that user_allow_other is set (i.e. uncommented) in /etc/fuse.conf.

1
  • A couple extra tips. 1) How do you find the remote user's ID? Run the command id remoteUser (in the remote shell). 2) On Mac, there seems not to be /etc/fuse.conf so just use the -o allow_other command line option.
    – Peter W
    Feb 24, 2021 at 4:34

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .