How can access to CD-ROM and USB be disabled for normal users in Linux?

As a part of security policy we need to disable CD-ROM and USB access for normal users. Only root users should have the access. We are mainly using Ubuntu Linux.

link|improve this question
Why is this a CW? – Chris S Jun 18 '10 at 18:32
feedback

5 Answers

Easier is to remove users from the 'cdrom' and 'plugdev' groups in /etc/group.

link|improve this answer
feedback

For simple protection against non-advanced users blacklisting the usb-storage module should be enough:

modprobe -r usb-storage
echo blacklist usb-storage >> /etc/modprobe.d/blacklist

To verify:

modprobe usb-storage
if ! lsmod | grep -q usb-storage; then echo Module is blacklisted; fi

For CD-ROM simply remove the user from the 'cdrom' group. Then the user should not be able to access it (in user management there is an advanced tab where you can uncheck such option).

link|improve this answer
feedback
up vote 1 down vote accepted

Found a solution to my issue.

Disabling USB

# mv /lib/modules/$(uname -r)/kernel/drivers/usb/storage/usb-storage.ko /root

Disabling CDROM

# mv  /lib/modules/$(uname -r)/kernel/drivers/cdrom/cdrom.ko /root

http://www.cyberciti.biz/faq/linux-disable-modprobe-loading-of-usb-storage-driver/

http://blog.ask4itsolutions.com/2010/05/07/disable-block-cddvd-rom-linux-rhel/

link|improve this answer
But this will disable access also for root, doesn't it? – mkudlacek Jun 23 '10 at 7:38
Yes root also, but root can easily enable it by moving back.This may not be an ideal solution, but it is okay in my case. – nitins Jun 23 '10 at 8:48
This is an worst possible solution(above solution).I think people need to look into their /etc/fstab file for that kind of manipulation.If they take out "nouser" option from the cdrom/dvd line in /etc/fstab file then the desired result can be achieved .Moving out and in modules like that is a bad very bad option. – unixbhaskar Jun 24 '10 at 10:56
1  
Yes, agree. askvictor's answer is better. – nitins Jun 24 '10 at 11:14
feedback

How about trying

chkconfig haldaemon off

This will prevent a normal user from seeing removable media devices. Only root will then be able to access removable media.

link|improve this answer
feedback

It used to be that on *nix systems you would do this by changing the read-write permissions on the devices nodes. I suspect you're going to need to look for something more involved in Ubuntu -- perhaps user groups that grant access to devices classes, disabling hardware services such as hal, or perhaps changing the automount system so things get mounted only for privileged users. USB will be more complicated than CDROM because I assume you don't want to block the whole bus. You want usb mice to work but flash disks to be blocked right?

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

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