0

Suppose a multiboot computer on which two GNU/Linux distributions are installed, each with its own user(s). Say those users don't share the same UID over the two systems.

Now one needs to access the user-owned files of the first system from the second.

I can think of a few methods (obviously by root or sudo, or by group, or by a dedicated user with same UID, or change owner (!), or switch user to numeric ID (but I don't think it is possible ?)…), each having its drawbacks.

Is there a recommended way to access such files ?

Note that the question is slightly broader than accessing files owned by a different user on the same system (actually this would correspond to the "dedicated user with same UID" solution), since in our case the UID does not correspond to a user.

Note also that there may be several users (and therefore multiple UIDs) on each system. User C on the second system may need to access files from both users A & B on the first system.

  • you may want Ansible or something to manage users so that the users are the same on both systems – thrig Aug 28 '18 at 18:18
  • Can you run NFSv4? Can do id mapping with that. https://serverfault.com/questions/812813/nfsv4-user-mapping – Mark Plotnick Aug 28 '18 at 18:39
  • @Mark Plotnick & thrig It seems the question was not clear enough, see edit. I doubt mapping IDs would help when there are more than two users one one system (or would it ?). – Skippy le Grand Gourou Aug 28 '18 at 22:26
  • 1
    If userid C needs to access files owned by userids A and B, you do this by choosing appropriate groups or ACLs. The fact that the filesystem is shared by two distros doesn't make the solution either easier or harder. – Mark Plotnick Aug 29 '18 at 05:38
  • @Mark Plotnick Seems that ACLs (when available) are the way to go indeed. Please make your comment an answer. – Skippy le Grand Gourou Aug 29 '18 at 06:42
  • 1
    Good. I found some existing answers about how to use groups and ACLs to share files, and rather than reiterate what they already say, I'd rather link this question to them as a duplicate, if that's OK with you. They are [How can I setup group permission for different user on multiple Linux installations](https://unix.stackexchange.com/questions/12891/how-can-i-setup-group-permission-for-different-user-on-multiple-linux-installati) and [Make all new files in a directory accessible to a group](https://unix.stackexchange.com/questions/12842/make-all-new-files-in-a-directory-accessible-to-a-group) – Mark Plotnick Aug 29 '18 at 14:12
  • I guess this question qualifies indeed as a duplicate of the first question, and Gilles' answer to the second question provides more relevant information than what I was expecting. Personally I'd just copypaste your two comments in an answer because I believe it would help in terms of readability, but it's up to you. – Skippy le Grand Gourou Aug 29 '18 at 15:52

0 Answers0