I am writing a Java application where i need to do a command line execution and get a result back, but when i execute the command, it ask for sudo password. So far i tried:
$ sudo -s
$ vim /etc/sudoers
# User privilege specification
root ALL=(ALL:ALL) NOPASSWD: ALL
javauser ALL=(ALL:ALL) NOPASSWD: ALL
:wq
$ 4 -r--r----- 1 root root 615 2011-10-26 09:23 sudoers
Once i execute the command it again asks "[javauser] password for javauser:". But i already mentioned noPASSWD.
whoami
returns alex
and I am adding it as this in the sudoers
file
# User privilege specification
root ALL=(ALL:ALL) ALL
alex ALL=NOPASSWD: ALL
# Members of the admin group may gain root privileges
%admin ALL=(ALL) ALL
# Allow members of group sudo to execute any command
%sudo ALL=(ALL:ALL) ALL
Running keeps asking me for my password, any ideas?
sudo visudo
instead ofvim
to edit the sudoers file. That way if you make a mistake the program warns you about it.