How can I request password when Usb hardware is plugged in?
at the moment I use Xubuntu 11.10, my question is:
How can I request password when Usb hardware is plugged in (usb mass storage or keyboard or other usb device)?
I plug usb mass storage: now xubuntu open a window and show me files and folders of a usb mass storage. I want that when I plug usb mass storage ask a "root/sudo" password and after show files and folder.
You can use chmod to change the permissions of the mount point so that only "trusted" users can access.
-- Use Chown to set the owner to trutsed_user.Trusted_group
-- add any user to the trusted group that is needed. (usermod)
-- chmod -R 770 /media ( or whatever the mount point is and the permission you want to set )
Hope this helps.
but now I can't see usb mass storage...
I want that system ask me a password when I plug usb device (usb mass storage or keyboard).
The user must allow others to write to their X session. [[ $DISPLAY ]] && /usr/bin/xhost +localhost in ~/.bash_profile would do that.
Write a udev rule to run a script when the USB device is plugged in. Best guidance here (it's a bit outdated. udevadm has take over from some of the commands listed there).
The script can use dialog or one of its equivalents (yad is good) to interact with the user and request the password.
The script will be running as root so can do anything, including mounting the USB device and starting the file browser on the user's desktop (best to su to the user when doing that).
Those steps do everything you asked for. You probably also want to check the password given ... ?
this night (Italian hour) I'll try your solution.
At the moment I found this:
Works great for usb mass storage.
|All times are GMT -5. The time now is 12:06 PM.|