1
Say I'm logged in as user 'rabbit'. Is there a way to mount external hdd as user 'kingcrab'?
I tried chown -R kingcrab:kingcrab /media/drive/ but the command doesn't stick. Owner of /media/drive remains as rabbit:rabbit.
1
Say I'm logged in as user 'rabbit'. Is there a way to mount external hdd as user 'kingcrab'?
I tried chown -R kingcrab:kingcrab /media/drive/ but the command doesn't stick. Owner of /media/drive remains as rabbit:rabbit.
2
It depends on the type of filesystem you're mounting.
Native Unix/Linux filesystems, such as ext4, store ownership information on disk. There's really no such thing as mounting a filesystem "as" a user; the files are owned by whoever the data on disk says they are. Different files can be owned by different people.
Non-Unix filesystems, such as FAT, generally don't store ownership information. (NTFS does, but not in a form that Linux can use.) Since Linux expects all files to have owners, the filesystem driver provides synthetic ownership information, making all the files appear to be owned by a single user that's specified at mount time. You can't change this ownership with chown
, because it's not actually recorded anywhere; it's just an illusion presented by a driver.
It sounds like you're probably dealing with the latter type of filesystem. In that case, you can specify a different synthetic owner for the files by adding a uid=n
option to the mount
command, where n is the numeric user ID of the "kingcrab" user.