We have several Linux boxes running Samba that are used 'locally', eg each branch gets their own Samba box to store and share files.

The office managers need to be able to add and remove users for their branch and need to be root for this action (afaik), but i would like to restrict them from issuing any other root-privileged command as we have regular screw-ups from their side.

My (limited) linux knowledge tells me this is not possible - you are either root or not - but i wondered if there are ways to limit the allowed commands in some way.

  • 3
    You could use sudo to allow users/groups to run selected commands with root previliges. Documentation can be found at sudo and also the Arch Wiki provides an easy introduction. – AcId Nov 18 '13 at 11:09

Add to your /etc/sudoers file the following line:

user ALL=(root) NOPASSWD: /bin/mount,/bin/umount

where user is your non-root user and /bin/mount,/bin/umount is the list of commands you want to execute as root.

Now the non-root user can use the sudo command to run /bin/mount and /bin/umount with root privileges.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.