I've got a problem in doing sudo working for mounting things (e.g. usb pen or optic discs). Details:
The OS: Slackware 13.0
The response to sudo -l
User user1 may run the following commands on this host:
(root) /sbin/shutdown -h now, /sbin/shutdown -r now
(root) /usr/bin/less /var/log/syslog
(root) /sbin/mount /dev/sda?, /sbin/umount /dev/sda?
(root) /sbin/mount /dev/hdc, /sbin/umount /dev/hdc
The first two (shutdown and reading the syslog) works as sudo, but the problem appears when I try to mount an usb memstick or an cd/dvd disc. In my case, sda (sda1) is the memstick in /dev, which I can mount as root using su, mount /dev/sda1 /media/usb.
When I try to mount it using sudo mount /dev/sda1 /media/usb
, doesn't work, I get the response:
Sorry, user user1 is not allowed to execute '/bin/mount /dev/sda1 /media/usb' as root on HOST1.
Firstly, I don't understand why the OS thinks user1 wants to execute /bin/mount when in sudoers is /sbin/mount.
If I use the full path sudo /sbin/mount /dev/sda1 /media/usb
, still doesn't work:
Sorry, user user1 is not allowed to execute '/sbin/mount /dev/sda1 /media/usb' as root on HOST1.
Here user1 is not allowed to execute /sbin/mount as root, why? According to sudo -l should have this privilege.
But after I mount the /dev/sda1 using su, I can umount it using sudo umount /dev/sda1
What's wrong? Why the umount works and mount doesn't?