Is it possible to modify a floppy disk image from linux without calling commands as root?
Right now I use:
losetup /dev/loop0 skeleton.img
sudo mount -t msdos /dev/loop0 /mnt/floppy
sudo cp kernel.bin /mnt/floppy/kernel.bin
sudo umount -d /dev/loop0
Is there a way to do this without doing anything as root?
Linux question
-
- Member
- Posts: 62
- Joined: Tue Feb 13, 2007 10:46 am
Linux question
I have an 80386SX 20MHz 2MB RAM.
It is my testbed platform. Only has the 3.5" and 5.25" floppy drives.
It is my testbed platform. Only has the 3.5" and 5.25" floppy drives.
- Brynet-Inc
- Member
- Posts: 2426
- Joined: Tue Oct 17, 2006 9:29 pm
- Libera.chat IRC: brynet
- Location: Canada
- Contact:
Re: Linux question
Root access, or being able to su/sudo to the root account (Right group perms) It necessary to be able to write to a device.uglyoldbob wrote:Is it possible to modify a floppy disk image from linux without calling commands as root?
Right now I use:
losetup /dev/loop0 skeleton.img
sudo mount -t msdos /dev/loop0 /mnt/floppy
sudo cp kernel.bin /mnt/floppy/kernel.bin
sudo umount -d /dev/loop0
Is there a way to do this without doing anything as root?
Allowing any user to write to a device wouldn't be very sane..
Although the Windows users here wouldn't understand this method of sanity..
-
- Member
- Posts: 62
- Joined: Tue Feb 13, 2007 10:46 am
The commands losetup and mount are non-optional, because you have to link the image file to a device, and you have to mount that.
But you don't have to su / sudo each time!
Add the losetup line to wherever your distro allows you to extend the boot process. (Since you only have to do that once.) For Gentoo Linux, that'd be /etc/conf.d/local.start. /dev/loop0 is now added at boot time.
Then add a line to /etc/fstab:
Now, users (or Makefiles... ) can mount the image file with "mount /mnt/image", and unmount it again, without root being involved anymore.
But you don't have to su / sudo each time!
Add the losetup line to wherever your distro allows you to extend the boot process. (Since you only have to do that once.) For Gentoo Linux, that'd be /etc/conf.d/local.start. /dev/loop0 is now added at boot time.
Then add a line to /etc/fstab:
Code: Select all
# <fs> <mountpoint> <type> <options> <dump/pass>
/dev/loop0 /mnt/image auto noauto,users 0 0
Every good solution is obvious once you've found it.