[PLUG] fstab hell(p)

Michael M. nixlists at writemoore.net
Mon May 15 21:00:12 UTC 2006


Paul Mullen wrote:
> On Mon, May 15, 2006 at 11:55:03AM -0700, Michael M. wrote:
>
>   
>> How do I look at the permissions set on the file system? I don't 
>> understand the distinction between the permissions of a mount point, a 
>> directory, a file, and a file system.
>>     
>
> A mount point is just a directory on another file system (any file
> system that isn't the one you're trying to mount). Typically, mount
> points live on the root file system. The mount point, being just
> another directory, has its own permissions settings, but these don't
> have any effect on what you can and cannot do to a file system once
> it's been mounted there. Once you've actually mounted a file system to
> a mount point, the permissions that used to be set on the mount point
> (when it was just a lonely directory) magically disappear, and the
> permissions of the root level of the mounted file system take their
> place. The mounted file system effectively "masks off" the original
> directory being used as the mount point.
>   
I follow all of that up until "the permissions of the root level of the 
mounted file system take their place." I still don't understand how a 
"file system" has permissions. Maybe it's just the terminology that is 
confusing me. I thought directories and files have permissions. I 
thought a "file system" referred to a file system type (ext3, ReiserFS, 
xfs, ntfs, etc.), and as such had no particular permissions.

In any case, I think I understand what you're saying with regard to how 
the permissions actually work. What you're saying is pretty much how I 
understood it all to work, it's just that way you're saying it that's 
new to me.

>   
>> The fstab entry, currently, is:
>> /dev/sdb1 /mnt/library ext3 defaults,users,rw,noauto 0 2
>>     
>
> Unless you want to be able to mount and unmount the "library" file
> system as a normal (non-root) user, then you don't neet the "user"
> option in your fstab (it's "user", not "users"). And if you want the
> file system automatically mounted when the system starts up, then
> remove the "noauto" option. Finally, "defaults" implies "rw", so it's
> not necessary to include. But it looks like you may know all this
> already.
>
>   
Yes, but like I said, I was desperate! I'll try anything.
>> But when I try to create a file as a user, I get 'permission denied.'
>>     
>
> That's because only root has write permissions to the filesystem. If
> you don't have a firm grasp on *nix file system permissions, the LDP
> has decent overview in their intro guide:
> <http://www.tldp.org/LDP/intro-linux/html/sect_03_04.html>
>
>   
Well I *do* have a decent understanding of the how permissions work, or 
I thought I did; what I'm shaky on (and nervous about) is the security 
issues with regard to mount points and top-level directories.
>> So if I change the ownership of /mnt/library to my own user and group, I 
>> would be able to write to the directory or partition or filesystem or 
>> however you want to phrase it?
>>     
>
> Yes, that would work, *if* you make those changes after the file
> system has been mounted.
>
> Try this, as root, with the file system mounted:
> 1) cd /mnt/library
> 2) mkdir mikes_stuff
> 3) chown mcubed. mikes_stuff
>
> Your normal user account should be able to read and write to the new
> "mikes_stuff" directory.
>
>   
That works just fine. But what still doesn't work is creating a 
directory (folder) or file with Nautilus. This is I think this is what 
really screwed me up.

I changed the ownership of /mnt/library to my user account, so that the 
permissions now read:

mcubed at debathlon:/mnt$ ls -al
total 12
drwxr-xr-x 3 root root 4096 2006-04-15 14:40 .
drwxr-xr-x 22 root root 4096 2006-05-15 03:12 ..
drwxr-xr-x 5 mcubed mcubed 4096 2006-05-15 13:07 library

/mnt itself is still owned by root, as I believe it should be.

This is how I had originally tried to set it up, several hours ago. (I'm 
going to cry!)

And you're right, my normal user account can read and write to the 
/mnt/library directory. From a terminal I can create files and 
directories under /mnt/library with my normal user account. I can also 
create directories under /mnt/library with Midnight Commander.

But when I click on the desktop shortcut for the mount point, Nautilus 
still will not let me create a folder or a file. If I open a 
sub-directory that I've already created (like /mnt/library/testdir) then 
I can create more folders and files with Nautilus. That, no doubt, is 
what has been happening all along. I didn't actually test it in a 
terminal when I had originally set it up this way, I just tried making a 
folder with Nautilus, and that failed, so I thought I had screwed up the 
permissions or ownership. I guess the moral of the story is don't trust 
friggin' GUI file managers when it comes to trying to figure these 
things out.

I want my day back!

Thanks to you and Rich for all your help.

-- 
Michael M. ++ Portland, OR ++ USA
"No live organism can continue for long to exist sanely under conditions of absolute reality; even larks and katydids are supposed, by some, to dream." --S. Jackson




More information about the PLUG mailing list