LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 08-04-2004, 01:04 PM   #1
azzurro
Member
 
Registered: May 2004
Posts: 39

Rep: Reputation: 15
Permissions: Fstab and some other mounting questions


I initially posted this in cragwolf's "Just Installed" thread but I think I really should create my own thread. Any clarification is greatly appreciated:


I am in the process of setting up a basic low-load Slackware server. I bought a 200gig hdd to complement my 80gig hdd. I did all the hard work of getting Slack up and running, and formatting and partitioning the new drive as ReiserFS. Before I did this, I had the 200 gig hdd formatted as ntfs so I could backup the 80 gig hdd onto it from within windows. I mounted the 200 gig ntfs drive, transferred my data back to the old drive, then partitioned and formatted the new drive. Now both drives are happily on my Slackware system in linux filesystems.

Now for the question: I would like this drive to behave as an extension of the 80gig drive. What I mean by extension is that I want to mount the drive inside the home directory of a specific user, and have this behave as if this directory "belongs" to that user.

My 80 gig drive has a swap partition and a root partition, and the 200 gig drive has one partition. I would like to mount it in the home directory of one of my users. What I did was I copied the fstab line for my root partition and obviously changed "/" to "/home/server/downloads", where server is the name of my user and downloads is what I would like to mount it as.

I am confused about three things:

1: Should I use, as options: "rw,user" or am I missing something? Is this umask business only for ntfs or fat partitions?

2: Why does the "defaults" fstab option not do what I want it to? (I can only access the drive as root, but I would like a normal user to be able to read and write to the drive). I do not understand why... the root partition is mounted using the defaults, yet, under different users, I have permission to write to certain areas of the disk.

3: I am mounting to /home/server/downloads. /home/server obviously already exists, but when I make the downloads directory, can I just make a folder, or do I need to make a link from /dev/hdb1? In terms of permissions, if I made the directory as a normal user, and the drive were mounted using "defaults". would it be possible for this user be able to read and write to this hard disk? Or is the only way for any user other than root to be able to write to the disk via the options "rw,user" when the drive is mounted?

Another thing: If I make changes to fstab, is there a way to "refresh" and have the new changes take effect without a reboot? Or, when I'm experimenting, should I stick with the mount and umount commands?

Thanks so much in advance. I realize that my questions may be confusing, but I am really confused. I've tried looking for answers, but the man pages don't address my concerns and I haven't found any other useful documents.
 
Old 08-04-2004, 02:19 PM   #2
Finlay
Senior Member
 
Registered: Mar 2003
Location: Seattle
Distribution: Slackware ?-14.1
Posts: 1,029

Rep: Reputation: 47
check the permissions on:
/home/server/downloads
if you want users to access it make sure it is owned by the users group with whatever access you want the users to have.
If that doesn't help please post your fstab
 
Old 08-04-2004, 02:30 PM   #3
ringwraith
Senior Member
 
Registered: Sep 2003
Location: Indiana
Distribution: Slackware 15.0
Posts: 1,272

Rep: Reputation: 65
I think we need to see your /etc/fstab. The line for /home/server/downloads should provide the "link" to the /dev/hdb. You will then need to mkdir /home/server/downloads, if I understand your question.
 
Old 08-04-2004, 05:18 PM   #4
azzurro
Member
 
Registered: May 2004
Posts: 39

Original Poster
Rep: Reputation: 15
I already did a mkdir /home/server/downloads. Initially I did this as root, so root owned the folder. Then I rebooted with this fstab:

/dev/hda1 swap swap defaults 0 0
/dev/hda2 / reiserfs defaults 1 1
/dev/hdc /mnt/dvd-rom iso9660 noauto,owner,ro 0 0
/dev/hdd /mnt/cd-rw iso9660 noauto,user,ro 0 0
/dev/fd0 /mnt/floppy auto noauto,owner 0 0
devpts /dev/pts devpts gid=5,mode=620 0 0
proc /proc proc defaults 0 0

/dev/hdb1 /home/server/downloads/sorted reiserfs defaults 1 2


But I could not write to the directory unless logged in with root.

I remade home/server/downloads as my user 'server'. With this same fstab, will I be able to access and write to this folder? Or do I need to replace "defaults" with "rw,user" or something else?
 
Old 08-04-2004, 05:28 PM   #5
azzurro
Member
 
Registered: May 2004
Posts: 39

Original Poster
Rep: Reputation: 15
Didn't work using "/dev/hdb1 /home/server/downloads/sorted reiserfs defaults 1 2"

I created the folder, and the owner is server, of the group users.
After adding the above line to my fstab and rebooting, the same folder shows an owner of root in the group root. Other users only have read and execute permissions.

So I guess I will try replacing "defaults" to "rw,user" in the above line.
 
Old 08-04-2004, 07:06 PM   #6
azzurro
Member
 
Registered: May 2004
Posts: 39

Original Poster
Rep: Reputation: 15
And now


/dev/hdb1 /home/server/downloads/sorted reiserfs rw,user 1 2


didn't work either


Any ideas?
 
Old 08-04-2004, 07:42 PM   #7
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 drive is mounted, use the chown command on the mounted directory.

chown server /home/server/downloads/sorted

Make sure that the drive is mounted first.

This is in contrast to using an external usb drive. With some file systems such as vfat, or smb, the user and group ownership is set when mounting using the uid= and gid= options.

Also, double check whether or not you can read the contents of another login members home directory. If you have group ownership of users on all of the users, this may be the case.
 
Old 08-04-2004, 09:01 PM   #8
Finlay
Senior Member
 
Registered: Mar 2003
Location: Seattle
Distribution: Slackware ?-14.1
Posts: 1,029

Rep: Reputation: 47
/home/server/downloads/sorted ???????
you need to 'mkdir sorted' also
 
Old 08-05-2004, 06:49 AM   #9
azzurro
Member
 
Registered: May 2004
Posts: 39

Original Poster
Rep: Reputation: 15
Quote:
Originally posted by Finlay
/home/server/downloads/sorted ???????
you need to 'mkdir sorted' also
Yes, I have done that.

Edit: Now I understand your confusion. I was always intending to mount to /home/server/download/sorted, but I forgot to add the /sorted in my original posts. Sorry about that!

Quote:
Originally posted by jschiwal
If the drive is mounted, use the chown command on the mounted directory.

chown server /home/server/downloads/sorted

Make sure that the drive is mounted first.

I will have to issue this command as root, correct? Will I need to do this each time that I reboot?


Quote:
Originally posted by jschiwal

Also, double check whether or not you can read the contents of another login members home directory. If you have group ownership of users on all of the users, this may be the case.
I will check this when I get home. I think that all users that I create are automatically added to the group 'users.' I'm not sure that I understand how this relates to this issue. If you could clarify, that would be great.


Just so I understand, do you recommend that I use 'chown' to change the ownership of the mounted directory? Does it matter whether I mount the drive as:

/dev/hdb1 /home/server/downloads/sorted reiserfs rw,user 1 2

or

dev/hdb1 /home/server/downloads/sorted reiserfs defaults 1 2

?

Last edited by azzurro; 08-05-2004 at 06:52 AM.
 
Old 08-05-2004, 09:32 AM   #10
Finlay
Senior Member
 
Registered: Mar 2003
Location: Seattle
Distribution: Slackware ?-14.1
Posts: 1,029

Rep: Reputation: 47
try this:
/dev/hdb1 /home/server/downloads/sorted reiserfs defaults 1 2
 
Old 08-05-2004, 11:02 AM   #11
azzurro
Member
 
Registered: May 2004
Posts: 39

Original Poster
Rep: Reputation: 15
Quote:
Originally posted by Finlay
try this:
/dev/hdb1 /home/server/downloads/sorted reiserfs defaults 1 2
Only works if I'm logged in as root
Or should I use this line and chown as suggested by jschiwal?
 
Old 08-06-2004, 03:42 PM   #12
jschiwal
LQ Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682Reputation: 682
If you would include the output line from the mount command for your partition, and the output of ls -ld /home/server/downloads/sorted then we could follow along how the partition is mounted and what the permissions are. The -d option will print out the long listing of the directory entry itself rather than the contents of the directory. The -l option will show the user, group and other permission bits for the directory.

Your /home/server directory seems to be a place where you are storing downloads. You haven't indicated what your user name is. ( I'm assuming it isn't 'server' ). If so, you need to be a member of the group for the /home/server directory. Also the directory needs at least 770 permission to allow you to enter it and write files to it. ( The execute permission allows entering directories ) The files need at least 0760 permissions so the umask should be no more restrictive than 017.

Maybe things would be easier if the partition were mounted on the root partition instead. You could include a symbolic link from /home/server/downloads/sorted instead.

About the group users. It depends how the group permissions are set. I just purchased SuSE 9.1 myself. I had been using Mandrake. With Mandrake, their useradd script and GUI program will create a new group also by the same name.

My suggestion was to log in as one user and check if you can read files in another users home directory. If so, you may want add a unique group and chown all of your home directory to this group, ( probably using your login name for the group name ).
 
Old 08-07-2004, 06:17 PM   #13
azzurro
Member
 
Registered: May 2004
Posts: 39

Original Poster
Rep: Reputation: 15
'server' is actually the name of the user
This computer is actually going to be my personal server, mainly for storing my media files (so I can access them via the network), and also to run apache, among some other "server" tasks.

I created a new user (of the same group as 'server'), and I cannot access the test user's directory in home from server's account. The permissions are automatically set as 'rwx--x--x'.


My pertinent fstab section:

Code:
/dev/hdb1        /home/server/downloads/sorted reiserfs  rw,user 1 2
Relevant output of 'mount':

Code:
/dev/hdb1 on /home/server/downloads/sorted type reiserfs (rw,noexec,nosuid,nodev)
Output of 'ls -ld /home/server/downloads/sorted':

Code:
drwxr-xr-x  3 root root 48 2004-08-03 21:23 /home/server/downloads/sorted/
I'm looking at 'man mount' right now. All of the options (rw,noexec,nosuid,nodev) seem OK. The only thing that I do not understand is what suid means.

Quote:
suid
Allow set-user-identifier or set-group-identifier bits to take effect.
nosuid
Do not allow set-user-identifier or set-group-identifier bits to take effect. (This seems safe, but is in fact rather unsafe if you have suidperl(1) installed.)
I don't really know what this means. Is it possible that adding suid to the options will work, or am I misinterpreting?

The only problem seems to be that root is mounting the file system. I want the filesystem mounted by server.

There is something very interesting in mount(8), however:

Quote:
FILESYSTEM SPECIFIC MOUNT OPTIONS

The following options apply only to certain file systems. We sort them by file system. They all follow the -o flag

.
Mount options for adfs

uid=value and gid=value
Set the owner and group of the files in the file system (default: uid=gid=0).
This seems to only apply to the adfs filesystem. To me, it seems like the kind of thing that I would need. I see nothing of the sort for ext2, ext3, or reiserfs.


Is my only option at this point to use the chown command on /home/server/downloads/sorted? Is this something that needs to be done on each boot, and, if so, is there a way to have it done automatically?

Thank you so much for any help!

Last edited by azzurro; 08-07-2004 at 07:21 PM.
 
Old 08-07-2004, 09:30 PM   #14
azzurro
Member
 
Registered: May 2004
Posts: 39

Original Poster
Rep: Reputation: 15
Code:
chown server:users /home/server/downloads/sorted
It worked

I can reboot, and the owner is still server. My second harddrive is set up exactly the way that I would like it to be. Thanks so much for all the help I've received!
 
  


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
fstab permissions sall Linux - General 3 08-07-2005 12:57 PM
fstab... user needs permissions killahsmurf Slackware 9 03-26-2005 02:00 PM
File/Folder Permissions / Mounting hdd's / fstab <-- ?Questions? EThitop Linux - Newbie 2 06-19-2004 08:19 PM
/etc/fstab and permissions jeff1500 Slackware 7 03-27-2004 08:15 PM
Permissions and fstab help The SIN Raven Slackware 18 11-21-2003 05:54 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

All times are GMT -5. The time now is 07:49 AM.

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