Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Sudo-Mount

Status
Not open for further replies.

TECHMAN007

Technical User
Nov 30, 2000
212
US
I would like to give users the ability to mount a CD but I only want them to be able to mount the device. Anyone know the correct syntax to implement this in the sudoers file?

TIA!
 
Here you go
User_Alias PROCESSORS = patel
Cmnd_Alias MOUNT = /usr/sbin/mount
PROCESSORS ALL = NOPASSWD: MOUNT

It will let patel use mount as root without asking password.

Patel
 
I don't want him to have access to the command mount. I want him to have access to

#mount /dev/dsk/c#t#d# /cdrom

With specific flags/switchs.

If he has the ability to mount or unmount anything otherwise.
 
OK write a one line script called mountcdrom.sh without write permission.

#/bin/sh
/usr/sbin/mount /dev/dsk/????? /cdrom

User_Alias PROCESSORS = patel
Cmnd_Alias MOUNT = /path_to_script/mountcdrom.sh
PROCESSORS ALL = NOPASSWD: MOUNT

Now sudo mount will mount the /cdrom only

Patel
 
Darn ... now I feel stupid =) What a simple solution.

Thanks for the help.
*Man do I feel Sheepish - Baaaaaa*
 
Hi Techman,
You also want to give them umount option or u have to do umount all the time.

Patel
 
Yep ... .I just needed the general commmand syntax ... I didn't even think of doing them in a simple script file ... That was an oversight on my part.

Thanks for the help.

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top