In journal filesystem(for example ext4, XFS, ZFS, JFS, btrfs), there are file access permission rules.

Hence if I mount a HDD which include a unix OS on it, when I access the file on this disk without root priority, it will be failed to read or write it. However if the current username and password are same as the owner of this file on this disk.

What will happen?

If the access still remain failure, what information is involved in identifying this two different user with same username and password?


UNIX file permission metadata which is stored by any of the file systems you mentioned usually as extended attributes is stored as a numeric ID not as a name.

The file system driver is aware of file system metadata like extended attributes but not how to enforce them. Furthermore different metadata can be used for file permissions such as ACL support for Linux.

On Linux users are identified with a user ID determined by the name used in login and kept for the login session. Names can technically repeat in the /etc/passwd database though.

Further the associated password has no bearing on the file permissions if the login session has the same user id it has the same permission. Meaning if you change your password, it won't affect the file system permission. It will affect the login session and the password you type in when using sudo or su but the metadata on the file system only indicates which user and group its associated with.

  • Thanks so much for answering, Is the file system driver you mentioned a part of Linux kernel or independent software? – pah8J May 18 '18 at 3:16
  • +Martin S. Victory Some file systems are baked into Linux (they are not kernel modules) while others are. Never the less they exist as separate files in source code. For example here is ext4: github.com/torvalds/linux/tree/master/fs/ext4 – jdwolf May 18 '18 at 4:03
  • Hmm. 1) extended attributes have a particular meaning, and the user, group and access permissions of a file are usually not stored as such. (They're basic properties of a file on a Unix FS, there's not really anything "extended".) 2) What do you mean with "an ID that can not repeat"? User ID's can and will repeat between systems, and there's also nothing stopping you from having multiple usernames with the same UID on the same system. (It might not be very useful, and might lead to problems, but it's possible.) – ilkkachu May 18 '18 at 6:31
  • @ilkkachu I used the term metadata giving extended attributes as an example which is used for ACL support and thats mentioned in your link even. That seemed like it was pretty clear. On repeating IDs thats just confusing all around in fact the first sentence contradicts the second. I'll be updating that to be clearer and more accurate. "User ID's can and will repeat between systems" if you care to describe that in my answer in a way thats unambiguous in a way that meets your standards go ahead. I didn't realize that was something being confused here. – jdwolf May 18 '18 at 6:55
  • @jdwolf, The first sentence seems to imply that the permission metadata is stored as xattrs, but AFAIK, that's not the case for most filesystems, at least not for ext4. (And anyway, if the filesystem internally stores them the same way as xattrs, it's not very relevant to the system at large, since the owner and permission bits are considered part of the basic inode metadata.) – ilkkachu May 18 '18 at 7:23

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.