We need to perform mounting with root privilege, but after a simple mounting, we need to be root in order to write to the mounting point. This is the default for a simple mounting, check out more mounting examples here.
But we can grant the mount point ownership to other user besides root. We can do that by specified the user ID (UID) and user group ID (GID) at mount option. Let say a user call “macy”, wants to mount her external HDD and grant ownership to herself.
She must first check out her UID and GID. She do this:
cat /etc/passwd | grep macy
The 3rd column is UID and the 4th column is GID, the sample result shows as bellow:
Now she can mount her external HDD with sudo
sudo mount /dev/sda1 /mnt/USB -o uid=500,gid=500
/dev/sda1 is the device point, and the /mnt/USB is a mount point (a simple directory created by user). The important part I want to show here is -o which macy specified her UID and GID.