I know how to edit /etc/sudoers so that I can run a command as sudo without having to enter my password, however is there a way of allowing a program to be run completely without sudo, by all users of a group. (The programs I want to run is "mount" and "umount").
Suppose I wanted to add a group of users who are allowed to run
umount without passwords.
So I first want to add a group called "anyname"
sudo groupadd anyname
Next we need to edit the
/etc/group and add the users
will be present ,hence append users you want to add the users seperated by commas.
Now we need to configure sudo to allow members of the "anyname" group to actually invoke the
You just need to add the following lines to /etc/sudoers
%anyname ALL=NOPASSWD: /sbin/mount, /sbin/umount
sudo mount wont ask password but since it is a pain in the butt typing sudo all the time, we can avoid it by dong the following:
I can create the following script called "/usr/bin/mount" (and similar script for umount)
#! /bin/sh sudo /sbin/mount $*
To make this slightly more secure, We might want to change the ownership of these scripts to the "anyname" group.
chgrp anyname /usr/bin/mount /usr/bin/umount
and then make them executable only for the group "anyname"
chmod g+x /usr/bin/mount /usr/bin/umount
EDIT:Depending on the OS you are using please check where mount and umount commands are located. It might be in /bin/ instead of /sbin.So you might have to make necessary changes
IMPORTANT: BTW don't run the script on Arch based systems where all of the bin folders are symlinked with each other.