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 01-04-2006, 06:39 PM   #1
madman8
LQ Newbie
 
Registered: Jan 2006
Posts: 10

Rep: Reputation: 0
2nd HDD and permissions


Hi
Have just installed a second hard drive and added it to fstab. I can read files from it fine but I can not write to it as a normal user (only root can write to it). How can I make it so normal users can write to it or can I make it so only certain groups can write to it.
 
Old 01-04-2006, 06:45 PM   #2
J_K9
Member
 
Registered: Nov 2004
Distribution: Slackware 11, Ubuntu 6.06 LTS
Posts: 700

Rep: Reputation: 30
This How To will teach you (almost) all there is to know about fstab - I advise you begin by reading there, and if you have any problems just let me know.

Cheers,

-jk

Ps. Welcome to LQ!!
 
Old 01-04-2006, 07:03 PM   #3
madman8
LQ Newbie
 
Registered: Jan 2006
Posts: 10

Original Poster
Rep: Reputation: 0
Ok
I've make progress. I can get it so uses can mount the drives but the problem then is that only that user and root can write to the drives and if i have auto on then the drive is mounted at boot but i think it mounts as root so i back to square one. can you make it so it mounts the drive at boot as a certain group with read write for that group?
 
Old 01-04-2006, 07:18 PM   #4
J_K9
Member
 
Registered: Nov 2004
Distribution: Slackware 11, Ubuntu 6.06 LTS
Posts: 700

Rep: Reputation: 30
Do the settings for it include 'auto, user, rw'? That would allow read-write access to it for all the users on the system, and it would be mounted at boot.

As for group permissions - I think you'd have to do that manually.

eg. Log into the computer using a username belonging to the group which you want to be able to access the drive. Then, issue these commands:

Code:
$ su
Password:
# chmod a-rw /dev/sda1
# chmod g+rw /dev/sda1
Note: Replace /dev/sda1 with your drive name.

Cheers,

-jk
 
Old 01-04-2006, 07:27 PM   #5
shilo
Senior Member
 
Registered: Nov 2002
Location: Stockton, CA
Distribution: Slackware 11 - kernel 2.6.19.1 - Dropline Gnome 2.16.2
Posts: 1,132

Rep: Reputation: 50
Quote:
Originally Posted by madman8
Ok
I've make progress. I can get it so uses can mount the drives but the problem then is that only that user and root can write to the drives and if i have auto on then the drive is mounted at boot but i think it mounts as root so i back to square one. can you make it so it mounts the drive at boot as a certain group with read write for that group?
I think you are looking in the wrong direction. Why do you want an internal HDD to be user mountable? You just want users/groups to have specific permissions.

Here's an example from my /etc/fstab that may help you:
Code:
/dev/hda2   swap                    swap       defaults                0 0
/dev/hda1   /                       reiserfs   defaults                1 1
/dev/hdb2   /usr/share/multimedia   reiserfs   defaults                1 2
devpts      /dev/pts                devpts     gid=5,mode=620                0 0
proc        /proc                   proc       defaults                0 0
#none        /sys                   sysfs      defaults                 0 0
So you can see that I have two harddrives. The second is mounted under /usr/share/multimedia. If we look at the permissions:

Code:
shilo@shilo2:~$ ls -l /usr/share |grep multi
drwxr-xr-x    7 shilo users    152 2005-10-20 13:51 multimedia/
So I have given the directory the permission I wanted (In my case, I wanted the directory to belong to user shilo, evryone can read it, everyone can cd to it, only user shilo can write to it.

Doesn't matter that root mounted the filesystem. Just matters what the permissions are.

You will need to learn "chmod" and possible "chown" to get the permissions that you want.
 
Old 01-04-2006, 07:36 PM   #6
shilo
Senior Member
 
Registered: Nov 2002
Location: Stockton, CA
Distribution: Slackware 11 - kernel 2.6.19.1 - Dropline Gnome 2.16.2
Posts: 1,132

Rep: Reputation: 50
Quote:
Originally Posted by J_K9
Do the settings for it include 'auto, user, rw'? That would allow read-write access to it for all the users on the system, and it would be mounted at boot.
Maybe I'm misunderstanding what you are saying here, but it appears that this statement is just wrong:

"auto" = mount automatically (you got that right)

"user" = user can mount/unmount. Does not affect permissions, though.

"rw" = The media is both readable and writable. This does not mean that you are gauranteed those permissions. The files still have to have read and write permissions.

Look at your own fstab. Assuming the most basic partitioning scheme, you have a / partition. Note the absence of options. Yet /home is under /, and a usr still can read and write to his own home directory.

You may not want users mounting and unmounting any HDD that you give them permission to read and write from.

Just use "defaults" for the mount option. It will work.
 
Old 01-04-2006, 07:47 PM   #7
J_K9
Member
 
Registered: Nov 2004
Distribution: Slackware 11, Ubuntu 6.06 LTS
Posts: 700

Rep: Reputation: 30
shilo - Sorry, I did not word it properly. What I was trying to say was that it is mounted in read-write mode, and because of that you can give users read/write access to it as you wish.
Oh, and I don't have a separate /home partition - I put it all in one root partition.

madman8 - shilo's right. Just give it defaults and then chmod it as much as you wish.
 
Old 01-04-2006, 08:25 PM   #8
madman8
LQ Newbie
 
Registered: Jan 2006
Posts: 10

Original Poster
Rep: Reputation: 0
Sorry guys is should have mentioned it earlier but the drive is fat32 but I didn't know that you can chmod I device like that, actually I don't know much about chmod. I’ll give this ago:

# chmod a-rw /dev/hdb1
# chmod g+rw /dev/hdb1

Last edited by madman8; 01-04-2006 at 08:27 PM.
 
Old 01-04-2006, 08:35 PM   #9
shilo
Senior Member
 
Registered: Nov 2002
Location: Stockton, CA
Distribution: Slackware 11 - kernel 2.6.19.1 - Dropline Gnome 2.16.2
Posts: 1,132

Rep: Reputation: 50
Quote:
Originally Posted by madman8
Sorry guys is should have mentioned it earlier but the drive is fat32 but I didn't know that you can chmod I device like that, actually I don't know much about chmod. I’ll give this ago:

# chmod a-rw /dev/hdb1
# chmod g+rw /dev/hdb1
That won't work. FAT32 doesn't use permissions. See this post for the solution you need.


http://www.linuxquestions.org/questi...d.php?t=388848
 
Old 01-04-2006, 09:23 PM   #10
madman8
LQ Newbie
 
Registered: Jan 2006
Posts: 10

Original Poster
Rep: Reputation: 0
Thanks got it working now
 
  


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
Problem with a 2nd hdd Dark_Sniper* Linux - Hardware 10 05-19-2005 08:21 PM
How to format & mount 2nd hdd after FedCor1 has been installed on 1st hdd? clay394 Fedora 1 05-18-2004 01:50 PM
2nd hdd for linux 54az Linux - Newbie 7 02-06-2004 05:12 PM
Problem with 2nd HDD muah Linux - Newbie 7 01-12-2004 01:00 PM
2nd HDD TBBA Linux - Newbie 5 05-03-2002 01:40 PM

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

All times are GMT -5. The time now is 12:42 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