Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

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

1 Answer 1

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

 
discard

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.