Enable a user to gain write permission when mounting

October 10th, 2006 mysurface Posted in Admin, cat, mount, pipeline | Hits: 59449 | 2 Comments »

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:

macy:x:500:500:Macy Liew:/home/macy:/bin/bash

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.

2 Responses to “Enable a user to gain write permission when mounting”

  1. It is appropriate time to make some plans for the future and it’s time to be happy. I have read this post and if I could I wish to suggest you some interesting things or suggestions. Perhaps you can write next articles referring to this article. I wish to read more things about it!

  2. If some one wants to be updated with most recent technologies then he must be
    pay a visit this web site and be up to date every day.

Leave a Reply