When you mount the ext4 file system, it uses the permissions that are embedded in that file system. If you wish to override these, then use the following:
1. Find the UID of the user you want to mount as: id <username>
and look for UID=<userid>(<username>) GID=<groupid>(<groupname>)
2. sudo mount -o nosuid,uid=<userid>,gid=<groupid> /dev/whatever /media/wherever
This will mount the filesystem and mark the specified user as the owner of all files, and the specified group as the group for all files. nosuid
is a security measure that prevents the user from bringing in suid programs and using them to gain root access to the system (i.e, a suid version of bash on the filesystem). Adding the noexec
option will provide additional security, but will prevent the user from executing files on the filesystem.
Note: If you're just trying to interact with the file system yourself, you should either fix the permissions on the device, or interact with it as root if it's just a temporary thing (i.e., recovering a broken install).
If this is for mounting a USB or other removable external drive, you should check out the pmount
system which can automate the process for you, or at least make it considerably easier (i.e., pmount <device>
should create the folders for you, mount it as your user, and allow you to unmount it as your user)
Is there a reason why you don't want to mount it somewhere within your home directory? – Robert S Ciaccio – 2010-10-06T19:14:57.880