Re: USB drive mounted Read-only; what to do ?
On Sat 20 Dec 2014 at 15:13:04 -0700, Bob Proulx wrote:
> Andrei POPESCU wrote:
> > Brian wrote:
> > > Renaud OLGIATI wrote:
> > > > I plug in a USB pen drive, and launch dd to copy an iso image.
> > > >
> > > > # dd bs=4M if=debian-live-7.6.0-amd64-rescue.iso of=/dev/sdi && sync
> > >
> > > Thee is no need to be root to copy the ISO.
> > Of course there is no need to be root to copy an ISO file "around", but
> > permission to write directly to the raw device is equivalent to root, so
> > naturally this is not included in the permissions of "normal" users.
> > $ ls -l /dev/sda
> > brw-rw---- 1 root disk 8, 0 dec 20 23:16 /dev/sda
> But removable media is mounted as part of the "floppy" group not the
> "disk" group.
> $ ls -l /dev/sd?
> brw-rw---T 1 root disk 8, 0 Dec 9 13:24 /dev/sda
> brw-rw---T 1 root disk 8, 16 Dec 9 13:24 /dev/sdb
> brw-rw---T 1 root floppy 8, 32 Dec 9 13:24 /dev/sdc
> Here /dev/sdc is a usb storage device and it gets set up with the
> floppy group. The console user is also set up with the floppy group
> too. Assuming one of libpam, consolekit, systemd-login0 and so forth.
> Therefore the console user doesn't need to be root. They can write to
> the write to it directly.
It is assumed you are doing this on Wheezy. You are then the 100% correct.
brian@desktop:~$ ls -l /dev/sd*
brw-rw---T 1 root disk 8, 0 Nov 25 15:00 /dev/sda
brw-rw---T 1 root disk 8, 1 Nov 25 15:00 /dev/sda1
brw-rw---T 1 root disk 8, 2 Nov 25 15:00 /dev/sda2
brw-rw---T 1 root disk 8, 3 Nov 25 15:00 /dev/sda3
brw-rw---T 1 root disk 8, 4 Nov 25 15:00 /dev/sda4
brw-rw---T 1 root floppy 8, 16 Dec 20 23:04 /dev/sdb
brw-rw---T 1 root floppy 8, 17 Dec 20 23:04 /dev/sdb1
/dev/sdb is a USB stick I've just plugged in. I am a member of the
floppy group because d-i set the machine up that way many years ago.
> > From /usr/share/doc/base-passwd/users-and-groups.txt.gz
> > disk
> > Raw access to disks. Mostly equivalent to root access.
> True for non-removable media. Since it was declared to be a USB pen
> drive we can assume it will be in the floppy group. And this was
> confirmed by the poster in another message:
> Renaud OLGIATI wrote:
> > # ls -l /dev/sdi
> > brw-rw---T 1 root floppy 8, 128 Dec 19 07:59 /dev/sdi
Being a member of the floppy group on testing or unstable doesn't confer
the same privileges as it does on Wheezy.
>From the udev changelog of Sat, 26 Apr 2014 21:37:29 +0200.
* Drop our Debian specific 50-udev-default.rules and 91-permissions.rules
and use the upstream rules with a patch for the remaining Debian specific
default device permissions. Many thanks to Marco d'Itri for researching
which Debian-specific rules are obsolete! Amongst other things, this now
also reads the hwdb info for USB devices (Closes: #717405) and gets rid of
some syntax errors (Closes: #706221)
91-permissions.rules is the one to look at.
How does a user now get to use fdisk or write to a USB stick without libpam
etc and "so forth"? Or does it matter?