LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Hardware
User Name
Password
Linux - Hardware This forum is for Hardware issues.
Having trouble installing a piece of hardware? Want to know if that peripheral is compatible with Linux?

Notices

Reply
 
Search this Thread
Old 02-13-2010, 07:11 PM   #1
PhoenixAndThor
Member
 
Registered: Sep 2009
Location: Geogia, USA
Distribution: Ubuntu, Debian, Live CDs
Posts: 213

Rep: Reputation: 38
Lock a computer with a flash drive


First of all, I'm sorry if someone else posted a similar thread, but after about 2 days of googling and searching this forum, I have yet to find a solution to this problem.

I recently got a new Lenovo netbook and I want to make sure that what happened to my last laptop doesn't happen to this thing. I got the idea from some Windows software called Predator, that uses a flash drive to lock a computer. I also know that most Linux distros already have the required components to facilitate this (i.e, they know when you plug in a flash drive).

My question is, how do I get my netbook to run scripts or programs when a flash drive is unplugged? This is how I want it to work: The flash drive would be tethered to my wrist with a short strap (or a piece of fishing line, maybe a chain). When someone yanks the netbook away from me (i.e, a thief), they would rip the drive out of the USB port in the process. The netbook, immediately sensing that the drive is no longer plugged in, runs miscellaneous programs or scripts in an attempt to thwart the thief, like activating the screensaver, adding a password to grub, sounding an alarm, and whatever else I want it to do.

I would eventually like to expand this to bluetooth headsets, and other devices that Linux can keep track of. It also has to fit in with my current setup. I installed Xubuntu 9.10 on the netbook and set it up to use an ext3 formatted flash drive as /home. I then installed truecrypt and created two file containers, one for the flash drive (small files, like assignments for college and app config), and one in a hidden directory on the hard drive in the netbook (large files, like my VirtualBox images).

This way, the system won't work right without the flash drive, and I can even switch flash drives in the future, when the one I'm currently using dies. Ideally, the system locking program/script would only check for a USB connected device with a special file on it.

If I can get this set up, it would be one of the coolest Linux tricks ever pulled with a netbook, and possibly the basis for an awesome new security tool for mobile users. Thanks in advance!
 
Old 02-13-2010, 07:18 PM   #2
bret381
Member
 
Registered: Nov 2009
Location: Alabama
Distribution: Arch x86_64
Posts: 648

Rep: Reputation: 78
sounds interesting
 
Old 02-13-2010, 07:32 PM   #3
irmin
Member
 
Registered: Jan 2010
Location: the universe
Distribution: Slackware (modified), Slackware64 (modified), openSuSE (modified)
Posts: 342

Rep: Reputation: 62
The easiest method to trigger some script if an event occurs is to use the D-Bus interface of HAL. Try for example:
Code:
dbus-monitor --system interface=org.freedesktop.org.Hal.Manager
When dbus-monitor is running, try to plug in and plug out an USB stick and watch the output. Maybe a combination of a shell script, dbus-send and dbus-monitor can be transformed to a solution of your problem?
Otherwise it is of course possible to handle events in any other language.
 
Old 02-13-2010, 07:58 PM   #4
Quakeboy02
Senior Member
 
Registered: Nov 2006
Distribution: Debian Squeeze 2.6.32.9 SMP AMD64
Posts: 3,245

Rep: Reputation: 121Reputation: 121
A thief generally isn't interested in what you have on the machine unless it's a corporate espionage theft. The fact that you do something (whatever that something is) is irrelevant. It doesn't take all that much to load a new OS onto the disk, no matter whether you wipe it, encrypt it, or whatever.
 
Old 02-13-2010, 08:28 PM   #5
jschiwal
Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 654Reputation: 654Reputation: 654Reputation: 654Reputation: 654Reputation: 654
A thief ripping right out of your hands is probably a meth addict. He won't spend time with what is on the computer, but the person he sells the computer to might.

I don't think breaking a bluetooth connection should cause anything drastic. Wireless connections break all the time.
IMHO, using encrypted partitions for /home, /tmp and swap and having the computer power down would accomplish what you want.
 
Old 02-13-2010, 08:47 PM   #6
PhoenixAndThor
Member
 
Registered: Sep 2009
Location: Geogia, USA
Distribution: Ubuntu, Debian, Live CDs
Posts: 213

Original Poster
Rep: Reputation: 38
First, I would like to thank you guys for the quick reply, except for quakeboy02, who obviously missed the mention of a siren. I would like to also add that I have already put a password on the BIOS and the hard drive, so the thief would need to know how to install a new drive to get around that (and trust me, where I live, they don't)

With that out of the way, I think irmin is on the right track, but the new 9.10 version uses devicekit and udev, good ol' HAL is being deprecated (sad to see it go), which is probably why I don't see anything while running the above command. But the code you posted did give me an idea. I tried dbus-monitor --system and it gave me a whole bunch stuff when I plugged in the flash drive, so it dbus-monitor may be piece of the puzzle. Here's the ouput:

Code:
signal sender=org.freedesktop.DBus -> dest=:1.128 serial=2 path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; member=NameAcquired
   string ":1.128"
signal sender=:1.2 -> dest=(null destination) serial=1412 path=/org/freedesktop/Hal/Manager; interface=org.freedesktop.Hal.Manager; member=DeviceAdded
   string "/org/freedesktop/Hal/devices/usb_device_1e3d_2092_200111000782"
signal sender=:1.2 -> dest=(null destination) serial=1413 path=/org/freedesktop/Hal/Manager; interface=org.freedesktop.Hal.Manager; member=DeviceAdded
   string "/org/freedesktop/Hal/devices/usb_device_1e3d_2092_200111000782_if0"
signal sender=:1.2 -> dest=(null destination) serial=1414 path=/org/freedesktop/Hal/Manager; interface=org.freedesktop.Hal.Manager; member=DeviceAdded
   string "/org/freedesktop/Hal/devices/usb_device_1e3d_2092_200111000782_if0_scsi_host"
signal sender=org.freedesktop.DBus -> dest=(null destination) serial=7 path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; member=NameOwnerChanged
   string ":1.129"
   string ""
   string ":1.129"
signal sender=org.freedesktop.DBus -> dest=(null destination) serial=8 path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; member=NameOwnerChanged
   string ":1.129"
   string ":1.129"
   string ""
signal sender=org.freedesktop.DBus -> dest=(null destination) serial=9 path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; member=NameOwnerChanged
   string ":1.130"
   string ""
   string ":1.130"
signal sender=org.freedesktop.DBus -> dest=(null destination) serial=10 path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; member=NameOwnerChanged
   string ":1.130"
   string ":1.130"
   string ""
signal sender=org.freedesktop.DBus -> dest=(null destination) serial=11 path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; member=NameOwnerChanged
   string ":1.131"
   string ""
   string ":1.131"
signal sender=org.freedesktop.DBus -> dest=(null destination) serial=12 path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; member=NameOwnerChanged
   string ":1.131"
   string ":1.131"
   string ""
signal sender=:1.2 -> dest=(null destination) serial=1436 path=/org/freedesktop/Hal/Manager; interface=org.freedesktop.Hal.Manager; member=DeviceAdded
   string "/org/freedesktop/Hal/devices/usb_device_1e3d_2092_200111000782_if0_scsi_host_0"
signal sender=:1.2 -> dest=(null destination) serial=1437 path=/org/freedesktop/Hal/Manager; interface=org.freedesktop.Hal.Manager; member=DeviceAdded
   string "/org/freedesktop/Hal/devices/usb_device_1e3d_2092_200111000782_if0_scsi_host_0_scsi_device_lun0"
signal sender=:1.2 -> dest=(null destination) serial=1438 path=/org/freedesktop/Hal/Manager; interface=org.freedesktop.Hal.Manager; member=DeviceAdded
   string "/org/freedesktop/Hal/devices/usb_device_1e3d_2092_200111000782_if0_scsi_host_0_scsi_device_lun0_scsi_generic"
signal sender=org.freedesktop.DBus -> dest=(null destination) serial=13 path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; member=NameOwnerChanged
   string ":1.132"
   string ""
   string ":1.132"
signal sender=org.freedesktop.DBus -> dest=(null destination) serial=14 path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; member=NameOwnerChanged
   string ":1.132"
   string ":1.132"
   string ""
signal sender=org.freedesktop.DBus -> dest=(null destination) serial=15 path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; member=NameOwnerChanged
   string ":1.133"
   string ""
   string ":1.133"
signal sender=org.freedesktop.DBus -> dest=(null destination) serial=16 path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; member=NameOwnerChanged
   string ":1.133"
   string ":1.133"
   string ""
signal sender=org.freedesktop.DBus -> dest=(null destination) serial=17 path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; member=NameOwnerChanged
   string ":1.134"
   string ""
   string ":1.134"
signal sender=org.freedesktop.DBus -> dest=(null destination) serial=18 path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; member=NameOwnerChanged
   string ":1.134"
   string ":1.134"
   string ""
signal sender=:1.38 -> dest=(null destination) serial=112 path=/org/freedesktop/DeviceKit/Disks; interface=org.freedesktop.DeviceKit.Disks; member=DeviceAdded
   object path "/org/freedesktop/DeviceKit/Disks/devices/sdb"
signal sender=org.freedesktop.DBus -> dest=(null destination) serial=19 path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; member=NameOwnerChanged
   string ":1.135"
   string ""
   string ":1.135"
signal sender=:1.2 -> dest=(null destination) serial=1460 path=/org/freedesktop/Hal/Manager; interface=org.freedesktop.Hal.Manager; member=DeviceAdded
   string "/org/freedesktop/Hal/devices/storage_serial_USB_Flash_Disk_200111000782_0_0"
signal sender=:1.2 -> dest=(null destination) serial=1462 path=/org/freedesktop/Hal/devices/storage_serial_USB_Flash_Disk_200111000782_0_0; interface=org.freedesktop.Hal.Device; member=PropertyModified
   int32 1
   array [
      struct {
         string "info.interfaces"
         boolean false
         boolean true
      }
   ]
signal sender=:1.2 -> dest=(null destination) serial=1470 path=/org/freedesktop/Hal/Manager; interface=org.freedesktop.Hal.Manager; member=DeviceAdded
   string "/org/freedesktop/Hal/devices/volume_uuid_49ED_21FF"
signal sender=org.freedesktop.DBus -> dest=(null destination) serial=20 path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; member=NameOwnerChanged
   string ":1.136"
   string ""
   string ":1.136"
signal sender=org.freedesktop.DBus -> dest=(null destination) serial=21 path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; member=NameOwnerChanged
   string ":1.136"
   string ":1.136"
   string ""
signal sender=org.freedesktop.DBus -> dest=(null destination) serial=22 path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; member=NameOwnerChanged
   string ":1.137"
   string ""
   string ":1.137"
signal sender=org.freedesktop.DBus -> dest=(null destination) serial=23 path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; member=NameOwnerChanged
   string ":1.138"
   string ""
   string ":1.138"
signal sender=org.freedesktop.DBus -> dest=(null destination) serial=24 path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; member=NameOwnerChanged
   string ":1.139"
   string ""
   string ":1.139"
signal sender=:1.2 -> dest=(null destination) serial=1510 path=/org/freedesktop/Hal/devices/volume_uuid_49ED_21FF; interface=org.freedesktop.Hal.Device; member=PropertyModified
   int32 2
   array [
      struct {
         string "volume.mount_point"
         boolean false
         boolean false
      }
      struct {
         string "volume.is_mounted"
         boolean false
         boolean false
      }
   ]
signal sender=org.freedesktop.DBus -> dest=(null destination) serial=25 path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; member=NameOwnerChanged
   string ":1.139"
   string ":1.139"
   string ""
signal sender=:1.38 -> dest=(null destination) serial=115 path=/org/freedesktop/DeviceKit/Disks/devices/sdb; interface=org.freedesktop.DeviceKit.Disks.Device; member=Changed
signal sender=:1.38 -> dest=(null destination) serial=116 path=/org/freedesktop/DeviceKit/Disks; interface=org.freedesktop.DeviceKit.Disks; member=DeviceChanged
   object path "/org/freedesktop/DeviceKit/Disks/devices/sdb"
signal sender=org.freedesktop.DBus -> dest=(null destination) serial=26 path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; member=NameOwnerChanged
   string ":1.138"
   string ":1.138"
   string ""
signal sender=org.freedesktop.DBus -> dest=(null destination) serial=27 path=/org/freedesktop/DBus; interface=org.freedesktop.DBus; member=NameOwnerChanged
   string ":1.137"
   string ":1.137"
   string ""
^C
 
Old 02-13-2010, 09:08 PM   #7
TB0ne
Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 14,775

Rep: Reputation: 2614Reputation: 2614Reputation: 2614Reputation: 2614Reputation: 2614Reputation: 2614Reputation: 2614Reputation: 2614Reputation: 2614Reputation: 2614Reputation: 2614
Quote:
Originally Posted by PhoenixAndThor View Post
First, I would like to thank you guys for the quick reply, except for quakeboy02, who obviously missed the mention of a siren. I would like to also add that I have already put a password on the BIOS and the hard drive, so the thief would need to know how to install a new drive to get around that (and trust me, where I live, they don't)
No, you did mention the siren, but I don't think it's of much good, honestly. If it's a 2 pound netbook, with the screen closed, how much volume is it going to produce? And that volume quickly drops to "nothing", once the thief spends a few seconds taking the battery out.

And the thief may not know (or care) how to wipe the drive, but if they only want to sell the machine, they won't CARE. Even if they want to use it, they can always hit Google, and figure out how to clear a BIOS password.
Quote:
With that out of the way, I think irmin is on the right track, but the new 9.10 version uses devicekit and udev, good ol' HAL is being deprecated (sad to see it go), which is probably why I don't see anything while running the above command. But the code you posted did give me an idea. I tried dbus-monitor --system and it gave me a whole bunch stuff when I plugged in the flash drive, so it dbus-monitor may be piece of the puzzle. Here's the ouput:
It is a nice idea. I use bluelock myself, so when my cell phone goes out of range, the screen locks. Could easily be modified to anything else, and could even work with your existing bluetooth headset (i.e. headset out of range? Lock the box...). Would be better than a piece of fishing line on a USB drive, as wearing a wrist strap/any tether, gets tiresome after a short time.
 
Old 02-13-2010, 09:26 PM   #8
Quakeboy02
Senior Member
 
Registered: Nov 2006
Distribution: Debian Squeeze 2.6.32.9 SMP AMD64
Posts: 3,245

Rep: Reputation: 121Reputation: 121
Quote:
Originally Posted by PhoenixAndThor View Post
First, I would like to thank you guys for the quick reply, except for quakeboy02, who obviously missed the mention of a siren.
Guilty. But, what kind of alarm are you talking about?

Also, if you do this, take care of how you actually attach it to yourself. If it's strapped to your wrist you can get seriously hurt by some of the synthetic fishing lines out there. Even if you use some sort of textile strap, if the line wraps around your wrist you can still get cut pretty badly.

There are just so many negatives to this idea, but if you get it working so that you're happy with it, good on ya.

Good luck!
 
Old 02-13-2010, 10:20 PM   #9
PhoenixAndThor
Member
 
Registered: Sep 2009
Location: Geogia, USA
Distribution: Ubuntu, Debian, Live CDs
Posts: 213

Original Poster
Rep: Reputation: 38
lol on the tether part. Of course I'm going to use a nylon bracelet, no matter what I tether the flash drive with. Fishing line would be an excellent choice in public places because it can't be seen very easily and its strong, but other options are available.

There is also a way around the battery problem. If it's brand new, then just glue the battery. It won't make it impossible to replace later, it will just require a good knife and patience, which a potential thief most likely will not have.

The whole flash drive thing is really meant to be temporary, I don't have a bluetooth headset yet. I also know that the sound on the netbook is crappy, but who says I can't put a real a siren on the back of the lid? Sirens can come pretty small and cheap these days. I was originally just going to put a bunch junk on the back of the lid, but I wanted to see if it was at all possible to use what the netbook already had to accomplish my goal. Now if I could just figure out what kind of code I have to put into a bash script to isolate and act on USB dbus events, then I may just be home free. Again, thank you all. I did not expect this fast of a response.
 
Old 02-14-2010, 12:03 PM   #10
jefro
Guru
 
Registered: Mar 2008
Posts: 11,737

Rep: Reputation: 1445Reputation: 1445Reputation: 1445Reputation: 1445Reputation: 1445Reputation: 1445Reputation: 1445Reputation: 1445Reputation: 1445Reputation: 1445
You encrypt the drive with a self signed certificate that you keep on the flash.
 
  


Reply

Tags
netbook, security


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
all software installs hang scroll lock and caps lock lights flash jcorrnt Linux - Hardware 6 02-07-2009 12:44 PM
Removed bad hard drive from computer, now flash drive won't mount. checkmate3001 Linux - Hardware 6 08-15-2008 12:03 AM
Ubuntu on USB flash drive - unable to lock ICEauthority ihaveebola Ubuntu 0 04-11-2007 11:56 PM
USB flash drive lock satimis Linux - Software 4 03-02-2006 05:49 AM
Computer won't see my Flash drive, what's up? SonoranFun Linux - Newbie 5 02-03-2005 01:59 PM


All times are GMT -5. The time now is 06:22 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration