LinuxQuestions.org
Latest LQ Deal: Latest LQ Deals
Home Forums Tutorials Articles Register
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, 01: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, 01:37 PM   #2
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

Rep: Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928Reputation: 928
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, 11:29 AM   #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, 03:54 PM   #4
Tinkster
Moderator
 
Registered: Apr 2002
Location: earth
Distribution: slackware by choice, others too :} ... android.
Posts: 23,067
Blog Entries: 11

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


Cheers,
Tink
 
  


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

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

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