0

I wrote a script that prompts me in dmenu the availible drives to mount or unmount and I added to the with visudo the following line

ALL ALL = NOPASSWD: /path/to/usb-mount

and the script basically takes decisions, and it executes one of this two lines

sudo mount $drive $target
sudo umount $drive

and I have a key binding that executes the command like

sudo /path/to/usb-mount

and well, It runs, it doesn't mount the drive, but if I run the script in the terminal, with sudo, runs the script and does mount.

Any Idea what I need to do?

Supposedly (to my understanding) If I run sudo all subsequent actions take sudo privileges.

3

Read the messages logged by sudo, typically written to either /var/log/secure or /var/log/auth.log (depending on distribution) to see what is going on.

Some distributions enable the requiretty setting in their default sudoers file or have it as a compiled-in default in sudo. This adds an extra step to using sudo in a non-interactive context (i.e. where it cannot ask for passwords nor output messages to the user). Run sudo -l as your regular user account: the output will tell you if the requiretty setting is in effect for you.

To remove this restriction from your user account, if your username is e.g. ekiim, you can add

Defaults:ekiim !requiretty

to the sudoers file after any existing Defaults lines.

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.