dd without sudo to image a partition

Is there a way to do it without sudo/su? Maybe by changing permissions on the usb drive?

If your /dev/sdb1 has permissions like:

$ ls -l /dev/sdb1
brw-rw---- 1 root disk 8, 17 Apr 25 17:07 /dev/sdb1

Then an option would be to add your user to the disk group:

# usermod --append --groups disk username

After that, the next time that the user logs in, they'll be able to read the device. Your dd should work after that.

What would be the security implications?

Since the user can read any disk directly, the user would have access to files owned by any user on any disk.

The user would be able to not only read any disk, but would also be able to write directly to any block device file with the same permissions (g+rw). That user could easily corrupt any filesystem by accidentally writing to those block device files. Changing permissions to disallow the disk group write permissions might have other side effects that I can't predict.

As a result, if you're on a multi-user system or on a system where you care about data stored on any disk, I don't recommend you do this. Normal users aren't given access to block devices because of the security implications.

Tags:

Sudo

Usb Drive

Dd