Fr0*_*Fyr 10
I know it's a terribly late answer, just thought it might help future readers. I posted the answer at Locking with USB drive
Well, a module called PAM (Pluggable Authentication module) can be customized to achieve your need. A beautiful article is available on linuxconfig describing this in detail.
The steps are:
Install PAM
$ sudo apt-get install pamusb-tools libpam-usb
Run Code Online (Sandbox Code Playgroud)Add USB device to PAM config
$ sudo pamusb-conf --add-device <my-usb-stick>
Run Code Online (Sandbox Code Playgroud)Select your volume and "Y" to save
Define user for PAM auth
$ sudo pamusb-conf --add-user <ubuntu-user>
Run Code Online (Sandbox Code Playgroud)Select and "Y" to save
Configure PAM
$ sudo gedit /etc/pam.d/common-auth
Run Code Online (Sandbox Code Playgroud)Add the line below and save
auth sufficient pam_usb.so
Run Code Online (Sandbox Code Playgroud)Test the PAM auth
$ su ubuntu-user
Run Code Online (Sandbox Code Playgroud)Lock when disconnected
$ sudo gedit /etc/pamusb.conf
Run Code Online (Sandbox Code Playgroud)Modify the block "user" block to look like:
<user id="ubuntu-user">
<device>
my-usb-stick
</device>
<agent event="lock">gnome-screensaver-command -l</agent>
<agent event="unlock">gnome-screensaver-command -d</agent>
</user>*
Run Code Online (Sandbox Code Playgroud)在
/etc/udev/rules.d/
Run Code Online (Sandbox Code Playgroud)
你可以写一个脚本
SUBSYSTEM=="usb", SYSFS{idProduct}=="PPPP", SYSFS{idVendor}=="VVVV", RUN+="/usr/sbin/usb-locking"
Run Code Online (Sandbox Code Playgroud)
其中,PPPP 和 VVVV 是您可以使用lsusb.
每个相同的产品都会匹配,但 USB 锁定可以安装设备,并查看驱动器本身以进一步合法化 - 一些文件,其中的一些字节码,日期......
当然,如果其他人可以使用棍子,它很容易受到攻击。
脚本可以每分钟进一步查看棒是否仍然安装,如果没有则锁定。
| 归档时间: |
|
| 查看次数: |
25948 次 |
| 最近记录: |