LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 05-18-2010, 02:34 PM   #1
Aigarzs
LQ Newbie
 
Registered: Jan 2008
Distribution: Slackware
Posts: 19

Rep: Reputation: 0
mount fstab option group


Good day!

I am trying to set up my usb device to be available to mount and umount only for me, not for other users. Using Slackware 12.2

Entry in fstab is as follows:
Code:
/dev/disk/by-label/USB 	 /media/usb	vfat auto,group,user,noexec,gid=usb,umask=007  0 0
device information:
Code:
lrwxrwxrwx 1 root root 1 2010-05-18 20:57 /dev/disk/by-label/USB -> ../../sdd1

brw-rw---- 1 root plugdev 8, 49 2010-05-18 20:57 /dev/sdd1
From man mount I have understood that according to my settings only users in group plugdev can mount device, and when mounted it should become owned by user who mounted it and group usb.

Question is: why every user on my system can mount usb device? And what is wrong in my understanding of fstab option group?
 
Old 05-18-2010, 02:37 PM   #2
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,066
Blog Entries: 11

Rep: Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910
If you're using KDE chances are HAL is helping them ... you could
play with the udev-rules for the device(s).
 
Old 05-22-2010, 12:29 PM   #3
Aigarzs
LQ Newbie
 
Registered: Jan 2008
Distribution: Slackware
Posts: 19

Original Poster
Rep: Reputation: 0
Thank you Tinkster.

It is exactly as you said. Playing some evenings with udev I have got what I wanted. Posting this reply just in case it could help someone.

Solution for Slackware 12.2.

USB plug/unplug event is forwarded to udev. Udev does it's stuff and then forwards to hal. If udev didnot solve mounting, hal does that. Noone acts against fstab settings. But hal does its own magic if no fstab entry for device. I solved all usb drives mounting within udev and fstab.

Good udev howto:
http://reactivated.net/writing_udev_rules.html

udev rules location on Slackware:
custom user rules: /etc/udev/rules.d
distribution rules: /lib/udev/rules.d

Udev useful commands:
Code:
#getting udev variables about /dev/sdc1
udevadm info -a -p $(udevadm info -q path -n /dev/sdc1)

#watching udev events occured
udevadm monitor --environment

#testing udev rules on /dev/sdc1
udevadm test $(udevadm info -q path -n /dev/sdc1)
#And here comes my two rules
#I have set them number 78
#After 60 and before system rule 79, because I need fstab info import after device is added.
Code:
#Here my custom script provides symlink name
#I need multiple fstab entries, 
#depending on how many usb devices are added and depending on device filesystem

ACTION=="add", SUBSYSTEM=="block", ENV{DEVTYPE}=="disk|partition", ENV{ID_BUS}=="usb", ENV{ID_FS_USAGE}=="filesystem", PROGRAM="/get/symlinkname/from/kernelname/and/fstype %k $env{ID_FS_TYPE}", SYMLINK+="%c", GROUP="usb", MODE="0770"

#Here custom script clears unused mounting points
ACTION=="remove", SUBSYSTEM=="block", ENV{DEVTYPE}=="disk|partition", ENV{ID_BUS}=="usb", ENV{FSTAB_DIR}=="/media/*", RUN+="/delete/mounting/point $env{FSTAB_DIR}"

As result now group "usb" can mount/unmount usb drives instead of default group "plugdev". Also devices are mounted to places I want according to fstab. No conflicts with hal, both KDE and Gnome work fine.
 
Old 05-22-2010, 04:54 PM   #4
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 23,066
Blog Entries: 11

Rep: Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910Reputation: 910
Awesome - thanks for posting your solution back in such detail! I'm sure other members
or visitors will find this helpful.


Cheers,
Tink
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
[SOLVED] Problem about noexec option in /etc/fstab jcky Linux - Newbie 17 09-14-2009 01:08 AM
Invalid mount option when attempting to mount the volume Dell x300 kstanton7 Linux - Laptop and Netbook 0 11-01-2008 11:09 PM
new fstab mount option guide for fixed drives - suggestions/mistakes? gregconquest Linux - General 3 04-21-2007 09:55 PM
fstab problem: mount: can't find dvd in /etc/fstab or /etc/mtab Nikon01 Slackware 5 11-17-2006 07:15 AM


All times are GMT -5. The time now is 01:11 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration