LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Red Hat
User Name
Password
Red Hat This forum is for the discussion of Red Hat Linux.

Notices


Reply
  Search this Thread
Old 05-22-2005, 02:31 AM   #1
Simon Bridge
LQ Guru
 
Registered: Oct 2003
Location: Waiheke NZ
Distribution: Ubuntu
Posts: 9,211

Rep: Reputation: 198Reputation: 198
automount vfat partition with rw access for any user


This is for RH9 with 2.4.20-6 kernel as dual boot (via GRUB) with win98SE on an 800MHz celeron aged machine.

I'd like users to be able to access the win98 vfat partition from their desktop. I can get fstab to mount it and an icon appears - however, since the mount user is "root" there is read only access (despite "rw" option in fstab)

The fstab entry goes something like this:

/dev/hda1 /mnt/c: user,rw 0 0

I realise I could set "noauto,users,rw", thus allowing usrs to mount and unmount at whim... but:
windows users are going to be logged in and I don't want to have to teach them about mounting and all. Presumably I need to be able to set the uid and gid for the filesystem. Or create a "windows" group perhaps?

Anyone tried this?
 
Old 05-22-2005, 07:03 PM   #2
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682
If the users are members of the "users" group, then you can use the "gid=users" option, and use a fmask of 0117 and dmask of 0007. This will allow reading and writing on this partition. If you want to give them read access to the win98 parition but not write access use "fmask=0137,dmask=0030".
If what you want to do is give anyone access to the partition, then use "fmask=0111,dmask=0000" for read/write access and "fmask=0333,dmask=0000".

As you probaby noticed, I didn't give "eXecution" rights on the fmask, but did on the dmask. That is because on a world writable partition, you don't want programs executed. However the 'x' bit is needed for directories. It allows you to enter directories, which you need to do to read files inside.
This precaution is even more important if someone has added ./ to their $PATH variable.

Last edited by jschiwal; 05-26-2005 at 01:25 AM.
 
Old 05-23-2005, 06:47 AM   #3
Simon Bridge
LQ Guru
 
Registered: Oct 2003
Location: Waiheke NZ
Distribution: Ubuntu
Posts: 9,211

Original Poster
Rep: Reputation: 198Reputation: 198
OK: I tried putting the following in fstab

/dev/hda1 /mnt/c: vfat gid=users,fmask=0660,dmask=0770 0 0

It didn't mount at all this time ... what if I said: uid=users,rw ??

I note from the "fat options" section in the mount manpage that the fmask and dmask numbers are the bitmask of permissions not present. So shouldn't that be: fmask=7117,dmask=7007 ?

(When I had the user,rw fstab entry, the mountpoint appeared on the desktop ... but with the one above, the mountpoint didn't. That's what got me confused. Anyway, the mount was fine, but the permissions (read and execute on files and folders) were weird! So there are two questions implicit in there ...)

Last edited by Simon Bridge; 05-25-2005 at 06:03 AM.
 
Old 05-24-2005, 05:53 PM   #4
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682
What is the name of the directory you are trying to mount to?

Get rid of that stupid colon!
 
Old 05-24-2005, 08:17 PM   #5
Simon Bridge
LQ Guru
 
Registered: Oct 2003
Location: Waiheke NZ
Distribution: Ubuntu
Posts: 9,211

Original Poster
Rep: Reputation: 198Reputation: 198
The directory is called "c:" because "c:\" it didn't like
It does the same if I call the directory "fubar".
jschiwal:
Quote:
Get rid of that stupid colon!
<gasp>! Are you a registered proctologist?
 
Old 05-25-2005, 05:15 AM   #6
Simon Bridge
LQ Guru
 
Registered: Oct 2003
Location: Waiheke NZ
Distribution: Ubuntu
Posts: 9,211

Original Poster
Rep: Reputation: 198Reputation: 198
Update:
The masks are for the permissions not present: so to set permissions to 0660 (-rw-rw---) I must set the mask to 7117.

I've been experimenting with mount -o options since I can do this many times without rebooting. Just to see what happens.

The mount command dosn't seem to see the dmask and fmask options, though umask works nicely. gid works, but only if suid is also set.

It would be desirable if I could set the permissions to
drwxr-x--- and -rwxrw---- (0750 and 0760, masks 7027 and 7017).

For now, I set umask=7007 (-rwxrwx---) since that allows the user to do what they want there. There are no linux executables native to the partition and the system does not have wine installed.

Not great.

Interestingly - noauto,user,rw still sets the x bit for owner (-rwxr-xr-x) for most files ... a few files have different permissions. Now I'm getting confused.

BTW: mounting at /mnt/win98 dosn't change anything.

Thinks: setting the first 3 bits to 000, dosn't activate the suid,sgid, and sticky thingys. If I make this a 6 (mask 1) then the suid and sgid bits are set. Does this make a difference? <checking> Nope...

options: users,suid,gid=users,dmask=1027,fmask=1017
mounts everything rwxr-xr-x ...
 
Old 05-25-2005, 05:39 AM   #7
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682
A colon character shouldn't be used because it can have a special meaning in a shell. Plus it is one of the seperation characters in various configuration files. Simply call it "c" if you want.

Also, "users" is a group and not a user. You can use the "gid=users" option. If you are the only person using the partition, then you can use "uid=<yourusername>" also.
 
Old 05-25-2005, 06:01 AM   #8
Simon Bridge
LQ Guru
 
Registered: Oct 2003
Location: Waiheke NZ
Distribution: Ubuntu
Posts: 9,211

Original Poster
Rep: Reputation: 198Reputation: 198
1. The colon character dosn't make any difference in this case (same trouble mounting to /mnt/win98 - it looks nicer though.)
2. I know users is not a user but a group and I did use gid=users. (that was a typo... "users" is also a mount option allowing anybody to mount/unmount a file system. See, I do read the man pages!) uid=<myname> does work to gain access - permission bits still set to rwxr-xr-x though. dmask and fmask still don't change permissions...

Is this something you've tried yourself? If so, please paste your fstab line here (either one of us can make the name changes required.)

Last edited by Simon Bridge; 05-25-2005 at 06:04 AM.
 
Old 05-25-2005, 06:06 AM   #9
Simon Bridge
LQ Guru
 
Registered: Oct 2003
Location: Waiheke NZ
Distribution: Ubuntu
Posts: 9,211

Original Poster
Rep: Reputation: 198Reputation: 198
perhaps I should allow it to mount under defaults somewhere else, then shift it and it's bitmasks via --bind or ...
 
Old 05-26-2005, 01:29 AM   #10
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682
You are right. I got my umask and fmask values negated. I've since changed them. Sorry for the confusion.

I don't know if on your system, the other users are members of the "users" group.
An option of 'users' (not gid=users) means that it is possible for an ordinary user to use the mount command to mount the device. If the device is a fixed hard-drive and not a key-pen usb drive, then you would probably want to mount it when the machine boots up. The 'noauto' option means that this partition will NOT be mounted automatically during boot. You would use the 'noauto' and 'users' option for a CDROM or floppy device. Because they are removable, and may not have media present when you bootup.
The sticky bit would protect group writable files from deletion but not modification. It is used for the /tmp partition to protect temporary lock files. The other extended bits like suid and sgid bits you don't want to use. They would elevate a persons rights when using the partition.

The 0 in front of the number in fmask=0666 for example indicates that the number is octal. Using fmask=666 may be the same as fmask=1232 but I'm not certain about that. It also may depend on the version of the mount program used. In any case, since it is an octal number, precede it with a '0'.

I just plugged a pen drive into my laptop. It uses the fat32 filesystem so it is similar as yours. Since it was automounted, I su'ed to root and unmounted it before my little experiment.
I used the mount command:rw
mount -t vfat /dev/sda1 /mnt -o rw,noexec,nosuid,fmask=0111,dmask=0,gid=users,iocharset=utf8
In an fstab entry, you would want to include the option auto for a fixed drive. As a regular user I was able to read and write to the drive. The directories have permissions of 'rwxrwxrwx' and the files have permissions of 'rw-rw-rw'. With the owner of root and group of users.

These options should work for you. I would still give the mount location a better name. Perhaps /mnt/windows_c. When the c:\ drive on a windows computer is mounted on a network, it is often given the name "c_drive" or "drive_c" But the colon isn't part of the name, it is part of the msdos command indicating that it is a device.

Last edited by jschiwal; 05-26-2005 at 01:34 AM.
 
Old 05-26-2005, 01:44 AM   #11
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682
I should of mentioned earlier that giving anyone but yourself access to the partition that contains the WINDOWS system directory would be a bad idea. Anyone could write a virus into your system (if you give them write access) or read your email messages ( messages read in windows ).
 
Old 05-26-2005, 03:27 AM   #12
Simon Bridge
LQ Guru
 
Registered: Oct 2003
Location: Waiheke NZ
Distribution: Ubuntu
Posts: 9,211

Original Poster
Rep: Reputation: 198Reputation: 198
Yeah, I've been thinking about this (below) only yesterday and figured that it would be better only to mount the "My Documents" tree from the windows partition.

Quote:
I should of mentioned earlier that giving anyone but yourself access to the partition that contains the WINDOWS system directory would be a bad idea. Anyone could write a virus into your system (if you give them write access) or read your email messages ( messages read in windows ).
Trying the mount options a bit later.
 
Old 05-26-2005, 08:37 AM   #13
Simon Bridge
LQ Guru
 
Registered: Oct 2003
Location: Waiheke NZ
Distribution: Ubuntu
Posts: 9,211

Original Poster
Rep: Reputation: 198Reputation: 198
Great - thanks, this will help clear things up... this is what I did:
Code:
[root@hauora3 guest]# mount -t vfat /dev/hda1 /mnt/win98 -o rw,noexec,nosuid,fmask=0111,dmask=0,gid=users,iocharset=utf8
[root@hauora3 guest]# ls -l /mnt/win98
total 4496
-rwxr-xr-x    1 root     users           7 May 14  2001 autoexec.bat
-rwxr-xr-x    1 root     users           0 Oct 30  2001 autoexec.bit
-rwxr-xr-x    1 root     users           0 Oct 19  2001 autoexec.via
drwxr-xr-x    6 root     users        8192 May 14  2001 bitware
-rwxr-xr-x    1 root     users       44337 Oct 19  2001 bootlog.prv
-rwxr-xr-x    1 root     users       45109 Oct 19  2001 bootlog.txt
-rwxr-xr-x    1 root     users       93890 Apr 23  1999 command.com
-rwxr-xr-x    1 root     users          30 May 14 17:15 config.sys
As you can see ... I did not get the same as you.
However, I did try the same mount command for a virgin (unsullied by windows) vfat partition. And it worked for that one, exactly the way you said it would and the way that the man pages say.

So this would appear to be a windows thing ... could win98 have something in the fat32 partition which could effect this? note, this partition was not formatted as fat32, but as fat16. This shouldn't make a difference to the fat fs mount-options, at least, not according to "man mount".

Or maybe this is a quirk of the windows root filesystem - and I should mount /dev/hda1 somewhere like /usr/win98 under defaults and then mount a subtree where the users can easily get to it?

To change track slightly: to my mind, the options... noauto,user,rw ...should disallow automount, but allow the user to mount the filesystem via the user mount tool, and the file system will be mounted read/wrote (x bit not set except for directories).

However, in practise, while users can mount OK, the owner is set to the username, and the permissions are unaltered from the above code section. Again, this behavior is unique to the win98 partition. Normal win32 partitions behave themselves.

Last edited by Simon Bridge; 05-26-2005 at 08:44 AM.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
vfat partition user permissions trawler Linux - General 3 10-25-2005 06:34 AM
Access to vfat drives as user. aje Slackware 24 05-22-2005 10:09 PM
Non Super Users can not access VFAT Partition shane25119 Linux - General 7 09-11-2004 10:25 AM
vfat partition access denied demmylls Linux - General 1 01-19-2004 02:09 AM
Access a vfat mounted partition vector Slackware 2 02-25-2003 09:54 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Red Hat

All times are GMT -5. The time now is 12:06 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration