LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   CentOS (https://www.linuxquestions.org/questions/centos-111/)
-   -   add mount command to all users in sudoers file (https://www.linuxquestions.org/questions/centos-111/add-mount-command-to-all-users-in-sudoers-file-4175575252/)

robertkwild 03-18-2016 07:10 AM

add mount command to all users in sudoers file
 
hi all,

i want to add all users to have the access to use the mount command ie atm when a user trys to use the mount command they get this -

[robw@robw-linux ~]$ mount -t cifs -o username=robertw //molfiler03/Public /mnt/Public/

mount: only root can do that

[robw@robw-linux ~]$

but obviously when i su into root i can mount it no problems

so can i use a variable ie like this in my sudoers file on a new line -

$USER ALL=/sbin/mount /sbin/umount

will this work for all the users on the system

many thanks

rob

lazydog 03-18-2016 11:58 AM

Quote:

Originally Posted by robertkwild (Post 5517563)
[robw@robw-linux ~]$ mount -t cifs -o username=robertw //molfiler03/Public /mnt/Public/

mount: only root can do that

Your command is wrong. You forgot to use 'sudo' in front of the command.

robertkwild 03-18-2016 01:02 PM

success!!!

add this to your fstab as root -

//molfiler03/Public /mnt/Public cifs user,username=robertw 0 0

now any user can mount this share by typing this command

mount /mnt/Public/

it will ask for the password for robertw as i havnt included the password paramenter aswell

the special paramenter is user, this means any user can mount this share, but only this share mind you


All times are GMT -5. The time now is 10:18 AM.