LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   how can I mount an fat32 partition with full access for a normal user? (FC5) (https://www.linuxquestions.org/questions/linux-newbie-8/how-can-i-mount-an-fat32-partition-with-full-access-for-a-normal-user-fc5-432981/)

thefinalxia 04-08-2006 06:26 AM

how can I mount an fat32 partition with full access for a normal user? (FC5)
 
Hi all,

I'm about to run out of space on my 60GB hdd (/dev/hda3), and I happen to have an extra 40GB hdd (/dev/hdb1) installed, which is a fat32 partition.

I now have the line below in my /etc/fstab

*
*
/dev/hdb1 /mnt vfat defaults 1 1
*
*

But after hdb1 has been (automatically) mounted, all the files on it has an ownership as "root:root".. and I would like to have hdb1 mounted under one of the normal user $HOME dir, with full access for a normal user. (which will make my life much more easier)..

I know it's all in the man pages, and I've read it many times.. Guess I really could use some help..

Thanks!

Dtsazza 04-08-2006 06:33 AM

The thing you need to change is the defaults bit, which defines the option with which the device is mounted. You'll need to know what your user ID (or UID) is - not your login name, but an actual number which represents your user to the system. You can issue the following command to find out (if you're curious, it displays all the lines from the login file /etc/passwd, filters them to only display the ones with your login name, then only shows the third field which is your UID):
Code:

cat /etc/passwd | grep <your username> | cut -d: -f3
Then, change 'defaults' to defaults,users,uid=<your user ID> and when you next mount the drive you should have the right permissions.

The reason being that non-Linux filesystems like FAT don't store file permissions, so Linux has to guess at them - and defaults to making it root-accessible. The uid=<UID> line tells Linux to consider that user as the owner of the files on the device (and you can also use gid= to set the owning group, should that be necessary). IIRC, you can also pass these options on the command line if you're mounting something manually as root but want to access is as a normal user.

Haiyadragon 04-08-2006 06:42 AM

Quote:

Originally Posted by thefinalxia
Hi all,

I'm about to run out of space on my 60GB hdd (/dev/hda3), and I happen to have an extra 40GB hdd (/dev/hdb1) installed, which is a fat32 partition.

I now have the line below in my /etc/fstab

*
*
/dev/hdb1 /mnt vfat defaults 1 1
*
*

But after hdb1 has been (automatically) mounted, all the files on it has an ownership as "root:root".. and I would like to have hdb1 mounted under one of the normal user $HOME dir, with full access for a normal user. (which will make my life much more easier)..

I know it's all in the man pages, and I've read it many times.. Guess I really could use some help..

Thanks!

Change the fat32 line to:
/dev/hdb1 /mnt vfat auto,user,umask=000,exec 0 0

The "auto,user,umask=000,exec" part is important.

thefinalxia 04-08-2006 09:36 AM

Thanks for the quick reply!

The problem is solved, for now.

Stillso much remains to be learned..

Haiyadragon 04-10-2006 02:02 AM

Quote:

Originally Posted by thefinalxia
Thanks for the quick reply!

The problem is solved, for now.

Stillso much remains to be learned..

You'll learn new things every day for a long time to come.


All times are GMT -5. The time now is 02:45 AM.