1

Suppose I have an image home.img of a home partition of another linux machine (B). On that machine there is a users userB and there is a special group, groupB. Consider for example a file fileB in the home partition of machine B. Suppose it is owned by userB and groupA.

Now if I mount (via mount home.img /mnt/homeB -o ro) the img file on another linux machine A (logged in as userA), fileB is now owned by userA.

Is it possible to modify the mount options such that the owner, groups and permissions are shown on machine A, as it would be shown directly on machine B (for example that fileB is owned by userB and not by userA)? Do I have to create a dummy userB and groupB on machine A?

3
  • 1
    See if bindfs meet your needs.
    – enzotib
    Commented Aug 19, 2012 at 12:58
  • 1
    @enzotib bindfs does some translation of permissions, but it doesn't do arbitrary translations of users, which I think student wants. Bindfs only translates one user and one group. Commented Aug 19, 2012 at 22:18
  • @Gilles Yes, that's what I want.
    – student
    Commented Aug 20, 2012 at 6:59

1 Answer 1

1

The problem you're running into is that userB on machineB has the same UID number as userA on machineA.

Linux filesystems store ownership by UID number, not name. So if the file is owned by a user with UID number of 1000, then whenever that filesystem is mounted on another machine, the file will appear to be owned by whatever user has a UID number of 1000.
Now in theory a filesystem could store file ownership by user name instead, but I do not think any do.

You must log in to answer this question.

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