LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Red Hat (https://www.linuxquestions.org/questions/red-hat-31/)
-   -   Disable automount on RHEL 6.1 (https://www.linuxquestions.org/questions/red-hat-31/disable-automount-on-rhel-6-1-a-4175450434/)

Curiosity42 02-16-2013 09:42 AM

Disable automount on RHEL 6.1
 
Always when a USB stick or CD/DVD-ROM is inserted in the PC, RHEL 6.1 automounts this hardware.
How can I permanently disable automount that only the root user can mount these devices manually?

John VV 02-16-2013 02:30 PM

edit /etc/fstab
add "noauto" and root only access

see
Code:

man mount
man fstab

also 6.1 is a bit out of date
RHEL 6.3 is current
you might want to upgrade soon

Code:

su -
yum --releaseserver=6.3 upgrade


Curiosity42 02-18-2013 02:56 PM

I have added to the /etc/fstab file the following lines:

Code:

/dev/sr0        /media          auto      ro,noauto,mount,exec    0 0
/dev/sdb1        /media          auto      rw,noauto,mount,exec    0 0

/dev/sr0 was always automounted to CDs/DVDs and /dev/sdb1 always to USB devices.
Now I have the problem that I cannot write to an USB stick in the root account even I specified rw in the fstab.

John VV 02-18-2013 09:00 PM

the /media part is a bit off

you can not mount directly in media .There needs to be a folder

" /dev/sr0 /media/CD.DVD.drive "
" /dev/sdb1 /media/USB.drive "

and make those two folders in /media "CD.DVD.drive" and "USB.drive" or whatever you want to call them

Curiosity42 02-19-2013 12:26 PM

@John VV Thanks for you help.

Just as reference for future questions about this problem.
To permanently disable the automount in RHEL 6.1 that only root can mount/umount USB or CD-ROM/DVD-ROM devices, I have done the following:

Code:

cd /media
mkdir dvdrom
mkdir usb

vim /etc/fstab (and added the following lines)

/dev/sr0        /media/dvdrom          auto      ro,noauto,mount,exec    0 0
/dev/sdb1        /media/usb            auto      rw,noauto,mount,exec    0 0


Agent 08-25-2016 01:02 PM

Use the following to disable USB sticks from auto-mounting:
Create the following file:
/var/lib/polkit-1/localauthority/10-vendor.d/20-disk.pkla
Insert info from the code box below.
Code:

[Disable mount]
Identity=unix-group:*
Action=org.freedesktop.udisks.filesystem-mount
ResultAny=no
ResultInactive=no
ResultActive=no

Logout, log back on, insert USB stick and receive a Unauthorized message.


All times are GMT -5. The time now is 10:33 AM.