Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I would like to setup sudoers to grant users to mount all kind of network shares and loop devices to their home directory.

Here is a try that I found and changed a bit on one old post in unix.stackexchange.com:

Cmnd_Alias       MOUNTING = "/bin/mount -t nfs,smbfs,cifs  //* $HOME", "/bin/mount -o loop * $HOME", "/bin/umount $HOME"
Cmnd_Alias       SYSTEMDIAG = "/bin/dmesg"   # Yeah, I also would like to do this
%users           localhost = NOPASSWD: MOUNTING, SYSTEMDIAG

I would like to be sure this is fine before attempting it.

share|improve this question

Line 1: Mounts Types: NetworkFileSystem, SambaFileSystems, and CommonInternetFileSystems on All Shared Paths to the Users Home Directory, Along with: Mount All Devices as a loop, Along with Unmounting, all Saved in the Array MOUNTING.

Line 2: Prints the kernel dump from the last successful boot, saved in the Array SYSTEMDIAG.

Line 3: If the User is logged in from a computer with the name localhost, he will not be asked for a password when executing commands in either Array.

Looks fine to me, unless your computer name is not localhost. Make sure to use visudo

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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