LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 04-17-2004, 08:39 AM   #1
chasn
LQ Newbie
 
Registered: Apr 2004
Distribution: Slackware 9.1
Posts: 24

Rep: Reputation: 15
Mount alters directory permissions


Hi,
Very new (3 days) to linux, unix etc. I installed Slackware 9.1, as dual-boot on an ext3 partition next to a Windows XP (NTFS) system.

I also created a small 1gb FAT32 partition so that I can file transfer between Linux and XP. Slackware installation setup recognised this, asked me what I wanted to mount it as; I chose '/fat-g', as in XP this is my g: drive. Setup also created an fstab entry for it, with 'defaults' for the options. As root, I have been able to read and write test files to this directory.

Today, for some strange reason the /fat-g mount directory disappeared - I had been setting up autofs (so that cd and floppy access is a little less neanderthal) and it probably had something to do with this. Note that autofs is not being executed at startup (another problem for another day), only if I explicitly run it, and the problem in this message happens regardless of whether I run autofs.

So I re-created /fat-g. Root access is now as before, but user access is denied. I have played around with fstab entries - currently it looks like this:
Code:
/dev/hda2        swap             swap        defaults         0   0
/dev/hda3        /                ext3        defaults         1   1
/dev/hda4        /fat-g           vfat        user             1   0
/dev/cdrom       /mnt/cdrom       iso9660     noauto,user,ro  0   0
/dev/fd0         /mnt/floppy      auto        noauto,user     0   0
devpts           /dev/pts         devpts      gid=5,mode=620   0   0
proc             /proc            proc        defaults         0   0
I think the problem is actually with the /fat-g mount directory permissions, which look like the first entry:
Code:
drwxr--r--    2 root     root         4096 Apr 17 13:01 fat-g/

drwxr-xr-x    2 root     root         4096 Apr 17 13:01 fat-g/
So I umount /fat-g, do chmod 0755, and then it looks like the second entry above. Then I manually mount /fat-g, and it goes back to looking like the first entry again. I throw ashtray across room.

The same happens if I chmod the permissions and reboot, which I'd expect as I assume that's just a long-winded way of re-mounting the drive.

It's quite possible that chmod 0755 isn't enough anyway to enable a user to read/write files to the drive, but if I can't change the permissions and make them stick I can't play around to find out what permissions are needed.

I guess it's irrelevant, but just in case, these are the permissions on the actual device in /dev:
Code:
brw-rw----    1 root     disk      3, 4    Jun  9 2002  hda4
This is exactly the same as my main ext3 root partition (hda3), so I doubt if this is a problem - though quite what the relationship is between the mount directory permissions, the device file permissions, and the fstab permissions, is an impenetrable mystery to me.
 
Old 04-17-2004, 11:32 AM   #2
michaelk
Moderator
 
Registered: Aug 2002
Posts: 14,931

Rep: Reputation: 1520Reputation: 1520Reputation: 1520Reputation: 1520Reputation: 1520Reputation: 1520Reputation: 1520Reputation: 1520Reputation: 1520Reputation: 1520Reputation: 1520
Add umask=000 option to the hda4 fstab entry.
 
Old 04-17-2004, 11:58 AM   #3
chasn
LQ Newbie
 
Registered: Apr 2004
Distribution: Slackware 9.1
Posts: 24

Original Poster
Rep: Reputation: 15
Ok, thanks, that works.

Now, would anybody explain to me why it works? I see that now my /fat-g permissions are:
Code:
drwxrwxrwx    2 root     root         4096 Jan 1 1970  fat-g/
So presumably mount directory permissions are set by fstab, and some sort of mask of 000 is setting them all to 'on'.

But why doesn't user do that?

And why is the date for the file now 1970, when it was todays date?

And does this all affect the individual file permissions that are set when files on this drive are created? e.g. if I use vi or pico to create a text file, are any of these settings affecting whether that file is accessible by everybody?

I have read as much as I can about file permissions, but most of the newbie stuff just tells me how to use chmod and what the basic permissions mean for an individual file, not how they are set and used by applications.
 
Old 04-17-2004, 03:15 PM   #4
michaelk
Moderator
 
Registered: Aug 2002
Posts: 14,931

Rep: Reputation: 1520Reputation: 1520Reputation: 1520Reputation: 1520Reputation: 1520Reputation: 1520Reputation: 1520Reputation: 1520Reputation: 1520Reputation: 1520Reputation: 1520
Quote:
It should be noted that the "umask" option in /etc/fstab deserves special mention because in Linux, permission control works differently for FAT32 and NTFS filesystems than it does for native Linux filesystems (ext2, ext3, reiser, etc.).

- The UNIX permissions of a directory onto which you mount a Windows filesystem can't be changed while the fileystem is mounted (the chang might appear to work, but it won't persist). If you need to change the UNIX permissions of the mount point, unmount the Windows filesystem before doing so.

- Windows doesn't support UNIX-style permissions, so you can only apply permissions to the entire Win filesystem, not to individual files/folders. The default permission mask applied to FAT32 volume at mount time are rwx for root, but only rx for normal users; this is modified with the "umask" option of the mount command.

- The value of the permission bits used with umask are the opposite of those used with the chmod command. For example, the following pairs are equivalent:

umask=000 and chmod 777
umask=022 and chmod 755

(credit goes to DMR from a previous post)
 
Old 04-17-2004, 07:56 PM   #5
chasn
LQ Newbie
 
Registered: Apr 2004
Distribution: Slackware 9.1
Posts: 24

Original Poster
Rep: Reputation: 15
Thanks, amazing.

So umask=022 would be rwxr-xr-x, which might also work? I'll try it anyway, just for interest.

Strikes me I've got no chance of ever mastering the system with this sort of thing going on. The whole permissions/drives thing seems to be a complete mess. I now find Xine will play the first 60 secs of a DVD and then crashes telling me I don't have the permissions needed to play a DVD (as root). I can't play an audio CD as a user, no permissions. Ho hum, it'll come I guess.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
mount:not a directory. Suse dvd mount problem tzanis Linux - General 8 11-06-2005 12:30 PM
Appeance Alters; Mistake Thorrn4 Linux - Distributions 3 03-30-2005 05:27 PM
How do I mount a samba directory with write permissions? xerogravity Linux - Newbie 7 12-05-2004 02:43 PM
Mount directory permissions Joe47 Fedora 2 07-13-2004 01:13 AM
write permissions for directory - not accidently move/deleted the directory linuxgamer Linux - Newbie 10 12-02-2003 04:04 AM


All times are GMT -5. The time now is 08:24 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration