LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux From Scratch (https://www.linuxquestions.org/questions/linux-from-scratch-13/)
-   -   Setting mount privileges on LFS partition (https://www.linuxquestions.org/questions/linux-from-scratch-13/setting-mount-privileges-on-lfs-partition-741296/)

Pestossimo 07-20-2009 12:05 AM

Setting mount privileges on LFS partition
 
I have a partition set aside to build my LFS system (/dev/hda1). I'd like to allow the lfs user to mount that partition, but no one else.

My strategy for this was to chown /dev/hda1 to lfs, then set the "owner" option in fstab. This would allow only the owner of /dev/hda1 to mount it. The only problem is that when I rebooted, the owner of /dev/hda1 changed back to root.

Is there a better way to do this, or is there a way to change the owner of the device permanently?

karamarisan 07-20-2009 01:14 AM

I don't have a straight-up answer for you, but here are two things that may help:
1. The reason it changes back is that, in modern Linux, a program called udev recreates device files from boot. If changing the ownership of /dev/hda1 is really the best way to do this, maybe it can be configured to make the file that way. That said...
2. Are you trying to prevent accidental or intentional mounting of this device? If the former is sufficient, a single line in sudoers that won't be hard to figure out (`man sudoers` to start) can allow lfs to mount it without a password. If the latter... well, you're not really going to be able to stop anyone with root from mounting. Anything you could do, they could undo. So, I hope it's accidentally mismounting you're afraid of.

Edit P.S.: NU?

Pestossimo 07-21-2009 12:38 AM

I have no intention of trying to prevent root from doing it. I was just hoping to make lfs the only unprivileged user able to mount the partition.

sudo may do the trick, but I'm not sure if sudo can be used in a script. I'd like to make the mount part of lfs's .bash_profile script.

P.S. What about NU?

Edit: Oh, my location. Went there for a year of grad school in '04-'05. Don't spend much time here, so haven't bothered to change it.


All times are GMT -5. The time now is 12:04 AM.