LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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 05-03-2013, 11:03 AM   #1
PeterSteele
Member
 
Registered: Jun 2012
Posts: 264

Rep: Reputation: Disabled
How to disable USB automount?


I've search for an answer to this question but haven't had much luck. I am running CentOS 6.4 and am doing a lot with USB sticks. CentOS conveniently mounts a USB stick that it detects has a formatted file system on it, except that I don't want it to do this. How can I turn off this feature?
 
Old 05-03-2013, 12:00 PM   #2
nonamedotc
Member
 
Registered: Mar 2011
Location: /
Distribution: Fedora (typically latest release or development release)
Posts: 370

Rep: Reputation: Disabled
If you are using GNOME (which is what I know in)

System --> Preferences --> Removable Drives and Media.

Here, you can change all the automount settings.

Hope that helps!
 
Old 05-03-2013, 01:08 PM   #3
PeterSteele
Member
 
Registered: Jun 2012
Posts: 264

Original Poster
Rep: Reputation: Disabled
I use Gnome as well, but there is no "Removable Drives and Media" entry under System Preferences, and nothing that even looks close. Are you using CentOS?
 
Old 05-03-2013, 01:16 PM   #4
nonamedotc
Member
 
Registered: Mar 2011
Location: /
Distribution: Fedora (typically latest release or development release)
Posts: 370

Rep: Reputation: Disabled
I have a Centos VM in the workplace which is what I checked. If you do not have the menu entry, can you try this in a terminal?

Code:
$ gnome-volume-properties
 
Old 05-03-2013, 01:48 PM   #5
PeterSteele
Member
 
Registered: Jun 2012
Posts: 264

Original Poster
Rep: Reputation: Disabled
Hmmm, the closest thing I have is gnome-volume-control, but that's for setting the speaker volume. Are these commands available through a yum package? I did a quick look but nothing seemed to match.
 
Old 05-03-2013, 04:31 PM   #6
mddnix
Member
 
Registered: Mar 2013
Location: Bengaluru, India
Distribution: Redhat, Arch, Ubuntu
Posts: 498

Rep: Reputation: 137Reputation: 137
If you want to mount usb device, but don’t want to open nautilus automatically every time usb device is inserted, then:

In nautilus,
  1. Edit->Preferences = Media (tab)
  2. Check “Never prompt or start programs on media insertion”
  3. Uncheck “Browse media when inserted”
If want to disable device mount itself, then try this:

Disable GNOME Automounting
 
1 members found this post helpful.
Old 05-03-2013, 04:37 PM   #7
nonamedotc
Member
 
Registered: Mar 2011
Location: /
Distribution: Fedora (typically latest release or development release)
Posts: 370

Rep: Reputation: Disabled
I am extremely sorry about this - I missed Centos 6.4!

Alternatively, you can potentially use gconf-editor (if I am not mistaken, this time).

Last edited by nonamedotc; 05-03-2013 at 04:38 PM.
 
Old 05-04-2013, 10:25 AM   #8
PeterSteele
Member
 
Registered: Jun 2012
Posts: 264

Original Poster
Rep: Reputation: Disabled
So that's an improvement. After making these changes in nautilus, the file browser no longer opens when I insert USB stick. The drives do continue to auto-mount though, under /media/<id>, just like before. I think this is controlled through something outside of nautilus, a system setting somewhere.
 
Old 05-04-2013, 12:58 PM   #9
nonamedotc
Member
 
Registered: Mar 2011
Location: /
Distribution: Fedora (typically latest release or development release)
Posts: 370

Rep: Reputation: Disabled
Take a look at this link - http://unix.stackexchange.com/questi...-6/74127#74127
 
Old 05-05-2013, 01:40 PM   #10
PeterSteele
Member
 
Registered: Jun 2012
Posts: 264

Original Poster
Rep: Reputation: Disabled
Hmmm. This talks about how to make something automount that isn't. I need to opposite. It does describe how to configure a new rules.d config to do this, so I might be able to use this same file for disable the automounting. Right now I don't have the rules.d file they describe here, so something else is actually doing the automounting.
 
Old 05-15-2013, 09:13 AM   #11
JollyRogers
Member
 
Registered: Sep 2003
Location: Va USA
Distribution: Slackware
Posts: 81

Rep: Reputation: 16
Is this what you want? To fully disable the gnome automounter?

# gconftool-2 --direct \
--config-source xml:readwrite:/etc/gconf/gconf.xml.mandatory \
--type bool \
--set /apps/nautilus/preferences/media_automount false
# gconftool-2 --direct \
--config-source xml:readwrite:/etc/gconf/gconf.xml.mandatory \
--type bool \
--set /apps/nautilus/preferences/media_autorun_never true

Last edited by JollyRogers; 05-15-2013 at 10:22 AM.
 
Old 05-15-2013, 09:42 AM   #12
PeterSteele
Member
 
Registered: Jun 2012
Posts: 264

Original Poster
Rep: Reputation: Disabled
I've run these commands and my USB sticks are still automounting. Are these settings intended to take place immediately or do I need to log out/in? I have too much stuff up and running right now to logout, but I'll hopefully be able to do that soonish...
 
Old 05-15-2013, 10:07 AM   #13
JollyRogers
Member
 
Registered: Sep 2003
Location: Va USA
Distribution: Slackware
Posts: 81

Rep: Reputation: 16
I tested with a DVD/CDROM without logging out/in or rebooting, and they are not automounting. Unfortunately, in the enviroment I am in, I cannot test with a usb stick, plus I have the usb-storage module disabled. It should however work.

ETA: I also have autofs off.
#chkconfig autofs off

Another option would be to add noauto to /etc/fstab for the devices being automounted...

Last edited by JollyRogers; 05-15-2013 at 10:25 AM.
 
Old 05-18-2013, 08:57 PM   #14
alpo85
Member
 
Registered: Nov 2012
Posts: 30

Rep: Reputation: Disabled
Sir/Ma'am,

Have you considered throwing a line in /etc/fstab?

Code:
/dev/sdc   /mnt/sdc   ext4  noauto,ro,nouser,noexec  1 2
Of course, replace "/dev/sdc" with your USB Drive and the "noauto,ro..." options, as required. Seemed to work for me on RHEL 6.4.

Hope it helps.


alpo
 
Old 05-20-2013, 08:12 AM   #15
PeterSteele
Member
 
Registered: Jun 2012
Posts: 264

Original Poster
Rep: Reputation: Disabled
I finally rebooted my PC and it appears the gconftool commands suggested by JollyRogers did the trick. My USB sticks no longer automount when I insert them. Not exactly an intuitive operation, or at least not well documented, but at least there is a way.

I will mark this thread as SOLVED.

Thanks for all the responses.

Peter
 
  


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
Disable automount under xfce cccc Debian 2 03-09-2011 05:12 PM
[SOLVED] Ubuntu Disable automount izghitu Linux - Software 3 07-19-2010 08:07 AM
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


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