LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   how to enable normal user to read/write ext3 partition (https://www.linuxquestions.org/questions/linux-general-1/how-to-enable-normal-user-to-read-write-ext3-partition-580638/)

hottdogg 08-29-2007 03:30 AM

how to enable normal user to read/write ext3 partition
 
Hi all,

here's my current fstab
Code:

/dev/sda6      swap            swap        defaults        0  0
/dev/sda5      /                ext3        defaults        1  1
/dev/sda1      /DOS            ntfs        noauto,owner,user,ro  0  0
/dev/sda7      /DATA            ext3        noauto,owner,user,rw  0  0
/dev/cdrom    /mnt/cdrom      auto        noauto,owner,ro  0  0
devpts        /dev/pts        devpts      gid=5,mode=620  0  0
proc          /proc            proc        defaults        0  0

Currently only root can mount and write to /DATA.
I want normal user to be able to write also in /DATA but not necessarily be able to mount.
How to achieve this?

if i change this line
Code:

/dev/sda7    /DATA      ext3      noauto,owner,user,rw  0  0
to:
Code:

/dev/sda7    /DATA      ext3      umask=0000,defaults  0  0
when i try to mount as root
there's error:
Code:

mount: wrong fs type, bad option, bad superblock on /dev/sda7,
      missing codepage or other error
      In some cases useful info is found in syslog - try
      dmesg | tail  or so

Anyone can help?
Thanks.

cgjones 08-29-2007 11:26 AM

I think that the easiest way to achieve this would be to set the mount options up like this:

Code:

/dev/sda7      /DATA            ext3        rw,suid,dev,exec,noauto,nouser,async  0  0
These should be the default options, with the exception of noauto. You might want to check the man page for mount on your system to double check these options.

You can then mount as root and create a directory with the proper permissions for your users to write to.

jay73 08-29-2007 12:50 PM

Well, if it's only one user, the most straightforward solution may be to chown the /DATA partition.

From the terminal (as root)

chown -R username:username /DATA

By the way, you can't write unless you mount. You can't tap a foot you haven't got.

hottdogg 08-30-2007 02:08 AM

Tried both,didn't work.
sorry, i think I have to make it a clear question.
How to make my /DATA so that only root can mount but all users can have write access to this partition without using any separate dir ? is this possible
yes, i have read man mount especially about the options but i'm confused with suid,nodev,etc.

b0uncer 08-30-2007 02:12 AM

I did this a while ago; haven't been messing around with user permissions and mounting too much lately, but actually it was chown'ing/chmod'ing the directory (when mounted). With FAT partitions you can give the umask mount option, but with ext3 it should be just about giving the correct permissions to the mounted filesystem (mount directory too, the top of the mounted filesystem). With mount options you can then control who can mount it, root only or users aswell.

bigrigdriver 08-30-2007 06:11 AM

Edit /etc/fstab to change option *user* to *nouser*. That prevents non-root users from mounting/umounting partitions. It's supposed to be the default behavior, so possibly just removing the *user* option would work. Explicitly stating *nouser* won't hurt anything.

Set the ownership of /DATA to root:users. Set the permissions to:
u +rwx
g +rwx
o --- (or whatever you want others to have).

The x permission on directories allows access to the directory (cd into) for members of the users group. Without x permission, users can't write to the directory.


All times are GMT -5. The time now is 04:58 AM.