In your production environment, you might want to block the use of USB Storage devices (like pendrive) and display a message to user who is trying to do so. This can be achieved by replacing the usb_storage module in following way:
[root@SwitchRoot ~]# vim /etc/modprobe.d/usb-storage.conf install usb_storage logger "User with uid $UID is trying to use usb storage" && zenity --warning --text "USB Storage not allowed" 2> /dev/null || echo "USB Storage not allowed" > /dev/tty0
Verify it by using a pendrive or with the following command:
[root@instructor ~]# modprobe usb_storage USB Storage not allowed
Above config will also generate a log message in /var/log/messages and will display a Graphical Notification on GUI.
How to block use of USB Storage on RHEL.
原文:http://bianliang.blog.51cto.com/10835708/1707977