2

Possible Duplicate:
Lock and Unlock from USB disk (pendrive)

When i use Windows, there is a program I use called Predator that locks my PC when I remove a certain USB flash drive. It then unlocks the computer when I reinsert it.

Is there any program like this for Ubuntu?

3 Answers3

3

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:

  1. Install PAM

    $ sudo apt-get install pamusb-tools libpam-usb
    
  2. Add USB device to PAM config

    $ sudo pamusb-conf --add-device <my-usb-stick>
    
  3. Select your volume and "Y" to save

  4. Define user for PAM auth

    $ sudo pamusb-conf --add-user <ubuntu-user>
    
  5. Select and "Y" to save

  6. Configure PAM

    $ sudo gedit /etc/pam.d/common-auth
    
  7. Add the line below and save

    auth    sufficient      pam_usb.so
    
  8. Test the PAM auth

    $ su ubuntu-user
    
  9. Lock when disconnected

    $ sudo gedit /etc/pamusb.conf
    
  10. 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>*
    

cuttlefish could be one solution to do it as @maythux suggested. I really can't comment on its capabilities, I prefer to stay away from 3rd party apps as much as possible.

Peachy
  • 7,235
  • 10
  • 40
  • 47
Fr0zenFyr
  • 330
1

Don't know of any program but you can create a simple script that can do that like in this example:

http://www.techienote.com/2011/03/lock-unlock-ubuntu-desktop-using-usb-drive.html

0

You can use cuttlefish

It does what you need plus more advanced options see this link to learn about