0

I just moved a drive from one computer to another and realised that files were no longer accessible due to UID mismatch. My user had UID 1000 on one computer and the drive, whereas my user had UID 1001 on the other computer.

Is there a way to store permissions on a file-system so that one does not rely on UIDs matching on all computers? Do ACLs and xattrs store UIDs or user names?

  • 2
    Im not an expert here but ACL's (and I believe xattrs) require uids/gids. It would possibly be easier to use a system to manage/centralize uids and gids then to try eliminate them as they are pretty fundamental to the OS. (maybe using ldap/sssd or a database backend plugged into PAM) – davidgo Dec 30 '16 at 10:22
  • Alternatively use a file system that doesn't permissions like that (FAT32) or make the files world readable. It might also work to use a sticky bit for a group that is available on "every" system so you would have a common denominator. – Seth Dec 30 '16 at 10:51
  • And even if you would store permissions not by some numerical id (which wastes a lot of space), what should happen if you move a filesystem from a computer that has user XYZ to a computer that doesn't have user XYZ? So you have the same problem either way. – dirkt Dec 30 '16 at 12:54
  • @dirkt: (Wishful thinking) It does not have to be wasteful. If UIDs and GIDs were UUID, they would grow from 4 bytes to only 16 bytes, which I feel is acceptable. Then it would be trivial for me to pick a UUID an ensure all my computers have my user correctly configured. – user1202136 Dec 30 '16 at 13:09
1

Short answer: No. Your question doesn't say what filesystem is on the disk you're moving, but the fact that it contains a UID on a Linux system suggest it's some variant of EXT, and the UID, GID etc are stored in the INODE structure as integers - see https://ext4.wiki.kernel.org/index.php/Ext4_Disk_Layout#Inode_Table.

If you want to move data owner-agnostically then you could format your disk to something like FAT32 which doesn't store ownership information, but then you lose things like case-sensitivity in filenames and journaling to protect against write errors.

If you only have a small number of computers then your best bet is probably to create all your users and groups with the same IDs. Read through the useradd/adduser and groupadd/addgroup documentation for your particular distro to see how to specify the number.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.