Is there a way to store user permissions "non-numerically" on a file-system?

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?

user1202136

Posted 2016-12-30T09:31:54.437

Reputation: 249

2Im 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 – 2016-12-30T10:22:44.423

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 – 2016-12-30T10:51:48.527

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 – 2016-12-30T12:54:35.723

@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 – 2016-12-30T13:09:45.193

Answers

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.

kbro

Posted 2016-12-30T09:31:54.437

Reputation: 121