You are not logged in.

#1 2007-09-14 07:13:51

synthead
Member
Registered: 2006-05-09
Posts: 1,337

Write access to mount points as a normal user?

I would really like to be able to write to USB flash drives, write to my windows partition, write to samba mounts, etc. as a normal user.  At the time being, whenever I want to access some stuff, I just su into root, but I really want to avoid having to do that.

Here is my fstab at the moment.  I haven't really touched it, but I've never really understood it as much as I'd like to.

# 
# /etc/fstab: static file system information
#
# <file system>        <dir>         <type>    <options>          <dump> <pass>
none                   /dev/pts      devpts    defaults            0      0
none                   /dev/shm      tmpfs     defaults            0      0

/dev/cdrom             /mnt/cd   iso9660   ro,user,noauto,unhide   0      0
/dev/dvd               /mnt/dvd  udf       ro,user,noauto,unhide   0      0
/dev/fd0               /mnt/fl   vfat      user,noauto             0      0
/dev/sda1  /mnt/windows   ntfs-3g  users,fmask=0113,dmask=0002,locale=en_US.utf8         0 0

/dev/sda4 / ext3 defaults 0 1

The user I'd like to give privileges to is called "max".  The mount points I'd like to give this user write access to is /mnt/samba, /mnt/usb, and /mnt/windows.

Offline

#2 2007-09-14 09:06:19

Kei
Member
Registered: 2007-04-05
Posts: 88

Re: Write access to mount points as a normal user?

When you mount a linux partition you can control permissions by changing the directory permissions of the mountpoint after mounting it. This is not possible while using vfat or ntfs partitions, because they don't support linux permissions. So there's another way to accomplish that: add the option umask=000. This sets the permissions of the mounted device to 777 (rwxrwxrwx) (umask=reversed permissions).

I don't use ntfs-3g. I don't know fmask and dmask, but I suggest you should read the manual (man ntfs-3g) or search the internet to check how to use these options.

EDIT:
Regarding the usb stick: If you're using HAL it should take care of it everytime you stick it in (I think it will mount it to /media/[devicename]). HAL should mount with user permissions.

Hope that helps.

EDIT #2:
Don't forget to add your user to the group "HAL"!

Last edited by Kei (2007-09-14 09:10:06)

Offline

#3 2007-09-14 17:07:03

tam1138
Member
Registered: 2007-09-10
Posts: 238

Re: Write access to mount points as a normal user?

Changing mountpoint permissions and umasks is dangerous and inconvenient.  The right way to do this is to allow max to mount /mnt/windows, in which case the resultant filesystem will be owned (and therefore rw) by max.  Check out the mount(8) manpage, specifically section (iii) of Description.

Offline

#4 2007-09-15 11:53:44

Kei
Member
Registered: 2007-04-05
Posts: 88

Re: Write access to mount points as a normal user?

The right way to do this is to allow max to mount /mnt/windows, in which case the resultant filesystem will be owned (and therefore rw) by max.

If you want to mount it at startup using fstab with the auto option, it will be mounted as root. You will have to run a script after Max' login. You could also remove the line from fstab and let HAL do its magic.

If you're running a multiuser environment umask is the better option, because using the user option while mounting will only allow Max and no other user to work with/unmount the fs.

Apart from these thoughts I agree with tam that umask is inconvinient and not very secure.

Offline

#5 2007-09-15 17:52:23

tam1138
Member
Registered: 2007-09-10
Posts: 238

Re: Write access to mount points as a normal user?

Kei wrote:

If you're running a multiuser environment umask is the better option, because using the user option while mounting will only allow Max and no other user to work with/unmount the fs.

Good point.  Though in the multiuser environment, I would use groups to control access: use the group= option in fstab, umask=0002, and add all users who need write access to the group.

Offline

#6 2007-09-23 11:44:32

synthead
Member
Registered: 2006-05-09
Posts: 1,337

Re: Write access to mount points as a normal user?

So I went poking around and came up with an fstab.  However, I can't mount drives as a regular user, and when I mount them as root, it still is only read only.

# 
# /etc/fstab: static file system information
#
# <file system>        <dir>         <type>    <options>          <dump> <pass>
none                   /dev/pts      devpts    defaults            0      0
none                   /dev/shm      tmpfs     defaults            0      0

/dev/cdrom             /mnt/cd   iso9660   ro,user,noauto,unhide   0      0
/dev/dvd               /mnt/dvd  udf       ro,user,noauto,unhide   0      0
/dev/fd0               /mnt/fl   vfat      user,noauto             0      0
/dev/sda1  /mnt/windows   ntfs-3g  user,noauto,rw         0 0
//JENNA/max  /mnt/samba   smbfs  user,noauto,rw         0 0

/dev/sda4 / ext3 defaults 0 1

Offline

#7 2007-09-23 17:07:25

Kei
Member
Registered: 2007-04-05
Posts: 88

Re: Write access to mount points as a normal user?

Have you already tried to use the mount options tam1138 and I mentioned? I'm sorry, but RTFM. Try 'man mount'; there you can find specific options for all types of filesystems available. I don't use ntfs-3g, so maybe there's extra documentation at 'man ntfs-3g' or something like that. When you've read the documentation and it's still not working, post here again and we'll see if we can help you.

kei

Offline

Board footer

Powered by FluxBB