neddie Posted July 25, 2006 Author Report Share Posted July 25, 2006 You're precisely right, on another system the owner will determine what I can and can't do, and I can't change the setup. That's precisely what I meant. So to solve the problem, either they give me the root password (very unlikely, and rather stupid) or I can't reformat my stick. So I'm forced to go down to the shop and buy another memory stick, and plug that in instead. I can't see how that is any more secure. No I don't want to change permissions on mkfs, because if I understand correctly, that would also give the normal user the privileges to format the system drives, which is precisely what I don't want to be able to do. And no I don't want to run as root all the time for precisely the same reason. I don't want root privileges! What I think would be a better solution, as I said, would be for normal users to be able to format their memory sticks without gaining all root privileges. In the same way that a normal user can currently wipe all the files off the memory stick without being allowed to wipe all the files off the system drives. Maybe there's some technical reason why that's not possible? And was this also the case when floppy disks were around, no normal users could format their own floppy disks? Quote Link to comment Share on other sites More sharing options...
pmpatrick Posted July 25, 2006 Report Share Posted July 25, 2006 Actually, I believe it's the permissions on the device file that cause the problem. Check out this code: [patrick@localhost ~]$ ls -l /dev/hde brw-rw---- 1 root root 33, 0 Jul 18 04:11 /dev/hde [patrick@localhost ~]$ ls -l /dev/sda brw-rw---- 1 root disk 8, 0 Jul 18 04:11 /dev/sda [patrick@localhost ~]$ ls -l /dev/sdb brw-rw---- 1 root disk 8, 16 Jul 18 04:11 /dev/sdb [patrick@localhost ~]$ ls -l /sbin/mkfs -rwxr-xr-x 1 root root 4920 Sep 19 2005 /sbin/mkfs* mkfs, and things it aliases for, are ordinary user executable. However, the device files are only writable by root and, in the case of devices using the scsi protocol as indicated by /dev/sd*, by root and members of the "disk" group. The scsi protocol is used by scsi hard drives, sata hard drives and usb mass storage devices like flash drives and memory sticks. If you have no scsi or sata hard drives, you could probably solve your problem by adding your user to the disk group. You would also have to change PATH for ordinary users to include /sbin so you wouldn't have to type out "/sbin/mkfs" instead of just "mkfs". Other than that, the only other way I can think of is to write some udev rules for usb mass storage devices that give ordinary users write permissions on their /dev file. It may be doable but it's really beyond me. If interested, check the rules files in /etc/udev/rules.d. Among other things, udev dynamically creates and destroys the device files for usb storage devices when you plug or unplug them. This is all done according the rules in rules.d. Personally, I don't see the need for it. If your on your own box, su to root and format. If your on someone elses box, ask them to do it for you. However, if that's the way you want to set it up, I'm sure it can be done somehow. The really great thing about linux is you can do pretty much anything if you understand it well enough. Quote Link to comment Share on other sites More sharing options...
neddie Posted July 25, 2006 Author Report Share Posted July 25, 2006 Thanks, that's interesting stuff! :) Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.