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").

  • What is your OS? Are you trying to mount a NTFS partition, EXT partition, or optical drive?
    – nate
    Aug 26, 2013 at 13:35

1 Answer 1


Suppose I wanted to add a group of users who are allowed to run mount and 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 mount and umount commands.

You just need to add the following lines to /etc/sudoers

%anyname ALL=NOPASSWD: /sbin/mount, /sbin/umount

Now 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.

  • 1
    Thanks. I actually have implemented using a global .bashrc, that contains a function mount that looks like this: mount { sudo mount $* } Aug 26, 2013 at 15:52

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .