LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   How to give not-root user ability to mount devices to any mount point??? (https://www.linuxquestions.org/questions/linux-general-1/how-to-give-not-root-user-ability-to-mount-devices-to-any-mount-point-374417/)

jdupre 10-18-2005 05:53 PM

How to give not-root user ability to mount devices to any mount point???
 
How do I allow any user or specific users to mount specific devices at a mount point they specify?

I see that fstab can be edited with an entry like so:

/dev/fd0 /media/floppy auto user,noauto


That would allow any user to
# mount /dev/fd0
and have it be mounted to /media/floppy

But if the user tried
# mount /dev/fd0 ~/mymounts/floppy
The mount would fail. The entry in fstab limits the mount to the mount point specified.

Specifically I need to be able to allow non-root users the ability to mount filesystems using the loop feature, as in
# mount -o loop some.fs.image /some/mount/point

Even if the user has read/write access to the /dev/loop(n) device nodes, it appears only root can mount. It seems to me that if a user has read/write access to a device, and read/write access to a mount point, they should be able to use mount regardless of what it says in fstab.

- Joe

Tinkster 10-18-2005 06:24 PM

If you REALLY require this feature you could
add a line per user into /etc/fstab, and tell them
to mount the devices not using the /dev entry
but rather the mountpoint to execute it, e.g.
mount ~/mymounts/floppy


Cheers,
Tink

P.S.: I don't think that rw to a loop from several mountpoints
would be a good idea.

baktor 10-18-2005 06:34 PM

jdupre, this is a very very bad idea. Let's say you give me rights to use mount and allow me to mount .iso's via loop to any directory that I can write to. (phrasing what you mention at the start of the thread). This is _ASKING_ to be hacked. All I would need to do is upload an .iso image of whatever I wanted...say my own personal executables that I built on my personal server. I could then mount that iso in say, /var. Suddenly I have all the programs/files in that iso at my disposal.

Might not sound like much, but if the user can write to /etc, that means with 1 .iso, I can overmap your /etc to be my /etc...which I know the root password for and have different config files for. Boom, your machine is mine.


This is just a taste of why mount is a root only program and why it is STRONGLY discouraged to do exactly what you are trying to do. Please take my post seriously and try to think of another idea for your problem. I would hate to hear later your machine has been hijacked or worse.

jdupre 10-18-2005 07:09 PM

Thanks for the advices. My requirements are that of a developer, not a system administrator. This is not a public machine, and "root" and myself are the only users on the system. I just hate having to su all the time just to mount/umount a filesystem I happen to be working on at the moment. (I am working with filesystem images that I mount as a loop device.) Apparently this can only be done as root.

I thought that by simply adding myself to the group that owns the /dev/loop devices I could overcome this limitation of mount.

Of course I could just always login as root, but that has it's drawbacks as well!

- Joe

baktor 10-19-2005 12:37 AM

I'd rather say you should setup a line in your /etc/fstab for the images. I am setup much like how your setup. I typically have 1 console window that's left logged in as root. Yes, bad. Yes, convenient.

trickykid 10-19-2005 06:42 AM

Setup and use sudo.. :rolleyes:

No need to login as root, just sudo as you can even make it passwordless if you really want to..

baktor 10-19-2005 10:45 AM

May want to look into the automounter as well. It's a little work to configure, but it may be a slick solution for your problem as well.

jdupre 10-19-2005 02:14 PM

The sudo utility is sweet. Does what I want and more.
Thanks.

flangemonkey 02-04-2012 11:03 AM

an alternative for others reading this now is fuseriso, although I am still fighting with getting the fuse system to recognise it in my kernel... :)


All times are GMT -5. The time now is 02:05 AM.