Monday, April 7, 2014

Mounting a USB Device in a Linux VM

I recently did some work for a customer. Part of the project included a security analysis of a Linux-based VM client. The client is configured to VPN into the customer’s data center, so there’s really no way to network into or out of it (not easily). My challenge was pulling a few files off the client. Solution? Not all that difficult, actually:

  1. Plug a USB device into the host machine
  2. In VMWare, connect to the USB device
  3. In linux, you need to create a mount point for the USB device, and then mount it
  4. From there, it’s a simple copy command.

mkdir –p /mnt/myusb

mount –t vfat –o rw,users /dev/sdb1 /mnt/myusb

Oops another challenge:

  • How do U know where the USB device ends up? I scratched my head for a while on that, until my buddy recommended I grep the logs.

Solution: I searched the logs for SCSI connections, by entering grep SCSI /var/log/messages and saw where the USB device had been attached.

Finally, it was a simple matter of copying the file, which was of course cp /root/myfile.txt /mnt/myusb and I was rocking!