LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Red Hat
User Name
Password
Red Hat This forum is for the discussion of Red Hat Linux.

Notices


Reply
  Search this Thread
Old 02-16-2013, 09:42 AM   #1
Curiosity42
LQ Newbie
 
Registered: Jan 2013
Location: Earth
Posts: 20

Rep: Reputation: 0
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?
 
Old 02-16-2013, 02:30 PM   #2
John VV
LQ Muse
 
Registered: Aug 2005
Location: A2 area Mi.
Posts: 17,627

Rep: Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651
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
 
Old 02-18-2013, 02:56 PM   #3
Curiosity42
LQ Newbie
 
Registered: Jan 2013
Location: Earth
Posts: 20

Original Poster
Rep: Reputation: 0
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.
 
Old 02-18-2013, 09:00 PM   #4
John VV
LQ Muse
 
Registered: Aug 2005
Location: A2 area Mi.
Posts: 17,627

Rep: Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651Reputation: 2651
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
 
Old 02-19-2013, 12:26 PM   #5
Curiosity42
LQ Newbie
 
Registered: Jan 2013
Location: Earth
Posts: 20

Original Poster
Rep: Reputation: 0
@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

Last edited by Curiosity42; 02-19-2013 at 12:28 PM. Reason: Corrected.
 
Old 08-25-2016, 01:02 PM   #6
Agent
LQ Newbie
 
Registered: Mar 2004
Posts: 3

Rep: Reputation: 0
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.
 
  


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
Disable automount under xfce cccc Debian 3 01-23-2019 08:36 AM
RHEL 6 - Disable Gnome DVD Automount mijohnst Red Hat 1 11-18-2012 06:43 PM
Disable Automount FC4 fuzzyheadedfreak Linux - Newbie 1 12-18-2005 01:39 AM
How to disable automount in Mandrake 10.1 deathbyswiftwin Linux - Hardware 3 04-11-2005 02:54 AM
Disable automount zokik Linux - General 5 12-07-2003 06:59 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Red Hat

All times are GMT -5. The time now is 04:10 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
Open Source Consulting | Domain Registration