LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   How to allow any user to mount disks with the mount command (https://www.linuxquestions.org/questions/linux-software-2/how-to-allow-any-user-to-mount-disks-with-the-mount-command-846777/)

Windows to Linux 11-26-2010 05:20 PM

How to allow any user to mount disks with the mount command
 
I know how to modify the /etc file to change permissions, but I don't think that it could apply to this:

I'm using my Ubuntu desktop to compile Linux From Scratch onto a Virtual Box disk image. I can make it mountable by using a vdfuse program I downloaded, but then I have to use sudo to mount the actual partition. I do not want to give another account the ability to use sudo.

p.s. does this only happen to certain distros, or is a part of the Linux kernel?

bigrigdriver 11-26-2010 07:29 PM

Using Ubuntu has colored your perception of sudo and how widespread the sudo command is given to users.

The permission to use sudo is setup during installation, to give you, the installing user, the ability to sudo. Users created after the installation aren't automatically included in sudo, because the configuration file (/etc/sudoers) is written at installation time.

You may edit the sudoers config file to give limited sudo permissions to individual users. You name the user, and specify which commands that users my use via sudo.

jefro 11-26-2010 08:10 PM

If a pre-set user can't be selected from a choice in some user management app then you may be able to change file permissions on the mount command.

Usually these distro's offer some way to change user permissions. In some disto's the default user can mount some drives while others it is automatic and others need special permissions added. It may be cryptic in which to select.

By default if you give them the right to be a su in sudoer's they are root and that is not a good choice unless you want them to be full admins.

ssenuta 11-27-2010 09:13 PM

The mount command has a the following options:

mount -o user ..allow an ordinary user to mount the file system.
mount -o users ..allow every user to mount and unmount the file system.

You can use the Linux /etc/fstab file to define how a devices get mounted.
Here is an example this kind of fstab entry:

/dev/pktcdvd0 /mnt/pktcdvd udf rw,noatime,noauto,users 0 0
/dev/sdc1 /mnt/pendrive vfat rw,noatime,umask=000,utf8,uid=500,shortname=mixed,flush,noauto,users,exec,suid,dev 0 0

Windows to Linux 11-27-2010 09:53 PM

First: I KNOW what sudo does, it gives a user full permission to do anything.
Second: Can fstab be applied to a file that is not always existing? It is the first time I have used a program this manner, mounting a VBox disk

I'll assume that restrictions on the mount command are inherent to Linux

P.S. This is the script I am using to mount the file

vdfuse-v80 -f ~/.VirtualBox/HardDisks/LFS.vdi ~/virdisk/mnt
sudo mount -o loop ~/virdisk/mnt/Partition1 ~/virdisk/LFS

vdfuse-80 was created by following the instructions found on:
http://forums.virtualbox.org/viewtopic.php?f=26&t=33355

bigrigdriver 11-28-2010 12:37 PM

Quote:

First: I KNOW what sudo does, it gives a user full permission to do anything.
As I pointed in my first reply, if the /etc/sudoers file is written to allow the user that much permission. The rules in that file can also place limits, i.e. allowing the user to use only certain commands as root.

Here's a short tutorial on editing sudoers using visudo:http://www.go2linux.org/sudoers-how-to

Quote:

Second: Can fstab be applied to a file that is not always existing?
If the file is a mountable file system, then you need to write a udev rule to create a persistent name for the device (as opposed to having a different name each time the device is connected to the system). Once you have a persistent name for the device you can then write an entry in fstab. Be advised that error messages will be generated if the device isn't connected at boot time, but that won't stop the system from booting. You will just have error messages in your logs. So long as you know the error only applies to that device, and the device operates when connected, you can ignore the error messages.

www.google.com/linux is your friend. Use it to research writing udev rules. There are some good short tutorials on the subject.

Windows to Linux 11-29-2010 06:21 PM

I'm afraid I don't follow, bigrigdriver... the fact that you refer to the file as a device gives me the impression that you think the vfs is an actual disk drive


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