LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   Mounting pendrive and cdrom automatically (https://www.linuxquestions.org/questions/slackware-14/mounting-pendrive-and-cdrom-automatically-784192/)

cola 01-23-2010 07:15 AM

Mounting pendrive and cdrom automatically
 
It i plug the pendrive or insert cd to cdrom it will be automatically mounted.
How would i do this?

I don't want to mount these manually from terminal.

voyciz 01-23-2010 08:21 AM

You'll need to write udev rules to handle this. Found in /etc/udev/rules.d

Here's some reading to do:
http://www.reactivated.net/writing_udev_rules.html

tommcd 01-23-2010 08:23 AM

Make sure you are a member of the cdrom and plugdev groups. Simply run the command groups to find out what groups your user name is a member of. For reference, here is what I get:
Code:

bash-3.1$ groups
users floppy audio video cdrom plugdev power netdev
bash-3.1$

Flash drives and data CDs should mount automatically in Slackware 13 if you are a member of those groups.

onebuck 01-23-2010 08:25 AM

Hi,

The mounting point can be controlled in the static '/etc/fstab' file.

'udev' & 'hal' should control the device itself. If you want to write rules for the 'udev' then look at 'Writing udev rules'.

:hattip:
The above link and others can be found at 'Slackware-Links'. More than just SlackwareŽ links!

tommcd 01-23-2010 08:26 AM

Quote:

Originally Posted by voyciz (Post 3837640)
You'll need to write udev rules to handle this. Found in /etc/udev/rules.d

Should not flash drives and data CDs be automounted as I said in my post? They are for me. Or am I missing something here?

cola 01-23-2010 08:28 AM

Quote:

Originally Posted by tommcd (Post 3837642)
Make sure you are a member of the cdrom and plugdev groups. Simply run the command groups to find out what groups your user name is a member of. For reference, here is what I get:
Code:

bash-3.1$ groups
users floppy audio video cdrom plugdev power netdev
bash-3.1$

Flash drives and data CDs should mount automatically in Slackware 13 if you are a member of those groups.

groups
Code:

groups: cannot find name for group ID 100
100 floppy audio video cdrom

But after inserting a cd if i click the cdrom from the left side column of pcmanfm i get messages:
Code:

You are not privileged to mount the volume "Softwares"

voyciz 01-23-2010 08:33 AM

Quote:

Originally Posted by tommcd (Post 3837647)
Should not flash drives and data CDs be automounted as I said in my post? They are for me. Or am I missing something here?

What is doing this for you is KDE I'm guessing. So if KDE wasn't running, no automount.

voyciz 01-23-2010 08:36 AM

cola, it sounds like things have been tampered with. Group 100 is the "users" group, and it's not good that your system doesn't know that.

For the permissions subject,
Edit /etc/fstab and add the "users" option to allow normal users to mount it.

tommcd 01-23-2010 08:37 AM

Quote:

Originally Posted by cola (Post 3837651)
But after inserting a cd if i click the cdrom from the left side column of pcmanfm i get messages:
Code:

You are not privileged to mount the volume "Softwares"

Post your /etc/fstab. Make sure the entry for your CDROM drive looks something like this:
Code:

#/dev/cdrom      /mnt/cdrom      auto        noauto,users,ro  0  0
Since you are a member of the cdrom group, if fstab has users in the options column it should allow you to automount data CDs.
Note that the entry for cdrom is commented out since hal and udev mount CDs automatically.

I don't know why you get this when you run the groups command:
Code:

groups: cannot find name for group ID 100
I don't see that when I run groups.

tommcd 01-23-2010 08:41 AM

Quote:

Originally Posted by voyciz (Post 3837657)
What is doing this for you is KDE I'm guessing. So if KDE wasn't running, no automount.

Well in my case it is XFCE. Anyway, thanks for clearing that up for me.

cola 01-23-2010 08:49 AM

@tommcd,
cat /etc/fstab
Code:

/dev/hda5        swap            swap        defaults        0  0
/dev/hda8        /                ext4        defaults        1  1
/dev/cdrom      /mnt/cdrom      auto        noauto,owner,ro  0  0
/dev/fd0        /mnt/floppy      auto        noauto,owner    0  0
devpts          /dev/pts        devpts      gid=5,mode=620  0  0
proc            /proc            proc        defaults        0  0
tmpfs            /dev/shm        tmpfs      defaults        0  0

/dev/hda14      /media/hda14    vfat        users,uid=1000,gid=100,exec,rw,auto 0 0


tommcd 01-23-2010 08:52 AM

Quote:

Originally Posted by cola (Post 3837671)
/dev/cdrom /mnt/cdrom auto noauto,owner,ro 0 0

Just change the owner option in your fstab to users and you should be able to automount data CDs. You will need to reboot the computer for this to take effect.

voyciz 01-23-2010 08:55 AM

Quote:

Originally Posted by tommcd (Post 3837674)
Just change the owner option in your fstab to users and you should be able to automount data CDs. You will need to reboot the computer for this to take effect.

This will make you able to mount them, not necessarily automount them. And no restart is needed, mount will check /etc/fstab each time it is called.

cola 01-23-2010 09:02 AM

Quote:

Originally Posted by voyciz (Post 3837676)
This will make you able to mount them, not necessarily automount them. And no restart is needed, mount will check /etc/fstab each time it is called.

You are right.It will mount after clicking the cdrom,but not automount.

voyciz 01-23-2010 09:05 AM

Look above, the link has been posted twice. Writing udev rules will take care of this.


All times are GMT -5. The time now is 04:55 PM.