/dev owner as current user?

Charles Curley charlescurley at charlescurley.com
Thu Sep 6 15:29:47 MDT 2012


On Thu, 6 Sep 2012 15:16:51 -0600
"S. Dale Morrey" <sdalemorrey at gmail.com> wrote:

> I'm using lubuntu precise.  I've noticed whenever I plugin anything to
> USB that it mounts to /dev/ttyUSBn but the device is always owned by
> root.
> Is there anyway to make it default to ownership to the currently
> logged in user?  Otherwise I have to remember to chown each time I
> plug in a new device.

Can you adjust udev to do that for you?

A better and easier solution is to see if udev puts it into a group
other than root, and add your user account to that group. For example,
on Debian I plug a USB thumb drive in, and see:

charles at yendi:~$ ll /dev/sdb*
brw-rw---- 1 root floppy 8, 16 Sep  6 15:22 /dev/sdb
brw-rw---- 1 root floppy 8, 17 Sep  6 15:22 /dev/sdb1
brw-rw---- 1 root floppy 8, 18 Sep  6 15:22 /dev/sdb2
charles at yendi:~$ 

Then I look at the floppy group:

charles at yendi:~$ grep floppy /etc/group
floppy:x:25:charles
charles at yendi:~$ 

So users root and charles can read and write to the device, and no
others.

-- 

Charles Curley                  /"\    ASCII Ribbon Campaign
Looking for fine software       \ /    Respect for open standards
and/or writing?                  X     No HTML/RTF in email
http://www.charlescurley.com    / \    No M$ Word docs in email

Key fingerprint = CE5C 6645 A45A 64E4 94C0  809C FFF6 4C48 4ECD DFDB


More information about the PLUG mailing list