LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Security (https://www.linuxquestions.org/questions/linux-security-4/)
-   -   Limit devices in Linux. (https://www.linuxquestions.org/questions/linux-security-4/limit-devices-in-linux-4175595672/)

hack3rcon 12-18-2016 03:45 AM

Limit devices in Linux.
 
Hello.
I use Debian 8.6 amd64 and I like to know how can I limit my Linux for use devices? For example, no one can attach a USB storage or other devices. I mean is something like Windows OS policy. Please look at:
http://woshub.com/how-to-disable-usb...-group-policy/

Thank you.

hazel 12-18-2016 09:50 AM

The simplest way to do it would be using traditional ownership and permissions. Find out what device file corresponds to each usb socket and set the world rights to none. Then only root can use it.

If you want some users to be able to use the device, assign it to a group that you have created, give the group appropriate rights and add those users to the group.

In any case, storage devices can't be used without being mounted, and only root can mount such a device if it's not listed in /etc/fstab as user-mountable.

jpollard 12-18-2016 10:04 AM

Quote:

Originally Posted by hack3rcon (Post 5643511)
Hello.
I use Debian 8.6 amd64 and I like to know how can I limit my Linux for use devices? For example, no one can attach a USB storage or other devices. I mean is something like Windows OS policy. Please look at:
http://woshub.com/how-to-disable-usb...-group-policy/

Thank you.

You can look at the udev rules used when identifying devices and adding them to the /dev filesystem.

You can even disable things like USB storage permanently, yet still allow keyboard/mouse connections.

hazel 12-18-2016 10:42 AM

The advantage of using udev rules is that you can make usage permissions independent of where the device is actually plugged in. A udev rule can identify a device by its vendor and product ID and then set its ownership and permissions accordingly.

The trouble with udev rules is that there is a steep learning curve for actually writing them. And of course the vendor/product thing won't work for unknown devices that users may carry in their pockets.

ondoho 12-18-2016 12:33 PM

blacklist the driver?
but idk, there's also internal usb devices, one wouldn't want to disable them.
however, drivers can be configured, too. that's where i'd look first.

hack3rcon 12-18-2016 12:34 PM

How can I use "udev"? Can you show me some examples?


All times are GMT -5. The time now is 03:55 PM.