Red Hat This forum is for the discussion of Red Hat Linux. |
Notices |
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
Are you new to LinuxQuestions.org? Visit the following links:
Site Howto |
Site FAQ |
Sitemap |
Register Now
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
|
|
05-22-2005, 03:31 AM
|
#1
|
LQ Guru
Registered: Oct 2003
Location: Waiheke NZ
Distribution: Ubuntu
Posts: 9,211
Rep:
|
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?
|
|
|
05-22-2005, 08:03 PM
|
#2
|
LQ Guru
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733
|
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 02:25 AM.
|
|
|
05-23-2005, 07:47 AM
|
#3
|
LQ Guru
Registered: Oct 2003
Location: Waiheke NZ
Distribution: Ubuntu
Posts: 9,211
Original Poster
Rep:
|
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 07:03 AM.
|
|
|
05-24-2005, 06:53 PM
|
#4
|
LQ Guru
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733
|
What is the name of the directory you are trying to mount to?
Get rid of that stupid colon!
|
|
|
05-24-2005, 09:17 PM
|
#5
|
LQ Guru
Registered: Oct 2003
Location: Waiheke NZ
Distribution: Ubuntu
Posts: 9,211
Original Poster
Rep:
|
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?
|
|
|
05-25-2005, 06:15 AM
|
#6
|
LQ Guru
Registered: Oct 2003
Location: Waiheke NZ
Distribution: Ubuntu
Posts: 9,211
Original Poster
Rep:
|
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 ...
|
|
|
05-25-2005, 06:39 AM
|
#7
|
LQ Guru
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733
|
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.
|
|
|
05-25-2005, 07:01 AM
|
#8
|
LQ Guru
Registered: Oct 2003
Location: Waiheke NZ
Distribution: Ubuntu
Posts: 9,211
Original Poster
Rep:
|
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 07:04 AM.
|
|
|
05-25-2005, 07:06 AM
|
#9
|
LQ Guru
Registered: Oct 2003
Location: Waiheke NZ
Distribution: Ubuntu
Posts: 9,211
Original Poster
Rep:
|
perhaps I should allow it to mount under defaults somewhere else, then shift it and it's bitmasks via --bind or ...
|
|
|
05-26-2005, 02:29 AM
|
#10
|
LQ Guru
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733
|
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 02:34 AM.
|
|
|
05-26-2005, 02:44 AM
|
#11
|
LQ Guru
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733
|
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 ).
|
|
|
05-26-2005, 04:27 AM
|
#12
|
LQ Guru
Registered: Oct 2003
Location: Waiheke NZ
Distribution: Ubuntu
Posts: 9,211
Original Poster
Rep:
|
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.
|
|
|
05-26-2005, 09:37 AM
|
#13
|
LQ Guru
Registered: Oct 2003
Location: Waiheke NZ
Distribution: Ubuntu
Posts: 9,211
Original Poster
Rep:
|
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 09:44 AM.
|
|
|
All times are GMT -5. The time now is 06:38 AM.
|
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.
|
Latest Threads
LQ News
|
|