# USB 管理

##### 限制用戶可存取 USB 硬碟

修改 /etc/modprobe.d/blacklist.conf

```
# These lines would disable the USB drive.
blacklist usb_storage
blacklist uas
```

重啟系統後，可以驗證設定是否生效，此設定可使以下 USB 裝置失效。

- USB 隨身碟
- USB 光碟機

##### USBGuard  


可管理特定的裝置才能使用 USB 連接

- [How to protect Linux against rogue USB devices using USBGuard](https://www.cyberciti.biz/security/how-to-protect-linux-against-rogue-usb-devices-using-usbguard/)

##### 安全的卸載 USB 碟

```bash
# Umount the USB drive
sudo umount /dev/sdc
# Poer down the USB drive
sudo eject /dev/sdc

# With udisks
# Umount the USB drive
sudo yum install udisks2
sudo udisksctl unmount -b /dev/sdc
sudo udisksctl power-off -b /dev/sdc
```