Archive

Posts Tagged ‘udev’

Accessing PL2303 USB serial adapter as non-root user

March 8th, 2013 No comments

If you plug the PL2303 USB to serial adapter (or any other FTDI-like USB adapter) into your USB port, udev creates a /dev/ttyUSBX device with limited read and write permissions (0660 per default). Usually, only the root user and a specific group can access the device at all . To access the device as a regular user, you can either become a member of that group (distribution specific, dialout on fedora) or tell udev to create the device with different read and write permissions.

Become a member of dialout

Simply run

# usermod -a -G groupname username

to add the user username to the group groupname. To verify, that a certain user is a member of a specific group, you can grep the file /etc/group for a user name

# grep username /etc/group

Note that you have to re-login for this changes to take effect.

Create the device with different permissions

Alternatively, you can tell udev to create the /dev/ttyUSBX device with different read and write permissions. Add a udev rule to /etc/udev/rules.d/, e.g. /etc/udev/rules.d/85-PL2303SerialPort.rules with the following content:

ATTRS{idVendor}=="067b", ATTRS{idProduct}=="2303", MODE="0666"

You can get the vendor and product id from lsusb or by looking at /var/log/messages when you plug in the device.

After saving the new udev rule, tell udev to reload it’s ruleset

# udevadm control --reload-rules

and eventually plug in your adapter.

Categories: Uncategorized Tags: ,

Unlocking a luks volume with a USB key

June 16th, 2009 5 comments

A luks encrypted disk partition is great. The only thing that can bug you from time to time is that you have to specify the key before you can use it. Or maybe, if you try to mount the volume with /etc/fstab, you’ll be prompted for the password during boot.

Wouldn’t it be great, if you could use a real key to unlock your encrypted volume? Not a keyfile, but a physically existent key like the ones you use to unlock your front door?!

Well, it’s not actually a key, but these LaCie USB Flash Drives come very close:

LaCie iamaKey USB Flash Drives

This article will show you, how to generate a random key for your luks encrypted volume, hide it on any USB flash drive and use udev to unlock and mount your luks volume whenever you plug this flash drive into a USB port

Read more…

Categories: Uncategorized Tags: , ,

Using udevadm to gather information about specific device

June 15th, 2009 3 comments

Usually, udevadm requires the sysfs device path of the device in question. But you can also ask udevadm which device path belongs to a certain device node. This gets really helpful if you combine these two queries.

Example: You want to get a list of attributes for a specific device. You do not know the complete device path; all you know is the device node /dev/sdb:

# udevadm info -a -p  $(udevadm info -q path -n /dev/sdb)

A nice document describing how to use this information to write udev rules can be found on http://www.reactivated.net/writing_udev_rules.html.

Categories: Uncategorized Tags: