How can i prevent copying data to usb devices in Linux Ubuntu 16.04. Is there anything like "Group policy" in Windows or similiar?
1 Answer
There may well be better, more bullet proof ways of doing it, but playing arround on my Ubuntu 16.04 system -
Ubuntu mounts disks at /media/USERNAME/XXXXXXXX so by changing the write permissions for /media/USERNAME they will not be able to access the mount point. You can do this (as root) using chmod 700 /media/USERNAME
A better way - depending on your needs - might be to stop the usb_storage module from loading, making USB disks unrecogniseable. You can do this with a command like
echo "blacklist usb-storage" >> /etc/modprobe.d/blacklist-usb.conf
And rebooting your system.
-
Also see unix.stackexchange.com/questions/403798/… for a more complex and comprehensive method.– davidgoApr 6, 2018 at 6:23
-
Thank you! But one more question..can i give chmod 755 (only read & execute ) permission by this way? Apr 7, 2018 at 21:21
-
Probably not - that would depend on the filesystem on the USB drive. I'm not a a PC to check, but I'm pretty sure Ubuntu mounts the drive with the permissions of person who is logged in, and more specific file perms will override the parent mount point details provided the user can read that mount point.– davidgoApr 7, 2018 at 23:58
usbmount
does, not sure about systemd-stuff).