4

Is it possible to Disable auto mount of External Harddrives or USB's in RHEL.

For security reasons I have to disable this feature.

And when I need it I will enable it back.

| improve this question | |
  • In nautilus? (The file manager) – daisy Dec 30 '12 at 6:48
  • I think you should manipulate udev's rules. – PersianGulf Dec 30 '12 at 8:09
  • How about this service autofs stop and chkconfig autofs off – OmiPenguin Dec 30 '12 at 10:15
  • RHEL5 does not auto mount these (at least not on my installations) - what are you referring to? I need to right-click on a symbol on my desktop to mount any such device - after udev made the device appear. – Nils Dec 30 '12 at 20:56
  • @Nils Im referring to External Hard drives. Wrong RHEL 5 does automount External hard drive once you mount them atleast mine does. And how do you right click the device which is not mounted as far as I know unmounted devices doesnot appear on Desktop. – OmiPenguin Dec 31 '12 at 6:19
2

Start with service autofs stop and chkconfig autofs off.  You can also disable GNOME's automounting with the following command:

gconftool-2 --direct \
    --config-source xml:readwrite:/etc/gconf/gconf.xml.mandatory \
    --type bool \
    --set /desktop/gnome/volume_manager/automount_drives false

If you also want to disable the automounting of media like CD/DVD drives, you can also add:

gconftool-2 --direct \
    --config-source xml:readwrite:/etc/gconf/gconf.xml.mandatory \
    --type bool \
    --set /desktop/gnome/volume_manager/automount_media false

For further security, you can also add the following line to /etc/modprobe.conf:

install usb-storage /bin/true

All of this together should totally disable automounting in RHEL 5/6.  This information comes from The NSA's "Guide to the Secure Configuration of Red Hat Enterprise Linux 5", section 2.2.2 ([direct link (PDF)]).

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.