I want to give sudo permission which does not ask a password while executing the script. The problem I face is I have to provide the process ID as argument while running the script. I have tried in visudo
the following entry, but it fails and tells no permission to execute the command:
user ALL = (root) NOPASSWD: /usr/java/jdk1.7.0_25/bin/jstack 21580
I have tried this also:
user ALL = (root) NOPASSWD: /usr/java/jdk1.7.0_25/bin/jstack
jstack
is the script to be executed and 21580
is the process ID of java
which gets changed randomly when do a service restart.
But it is not working. Can anyone help me with this?
I have fixed the issue by removing the (root) in
user ALL = (root) NOPASSWD: /usr/java/jdk1.7.0_25/bin/jstack
and all works fine now. My mistake only :)
The process ID is nothing but the process id for which the stack trace is to be printed.
more info: http://docs.oracle.com/javase/7/docs/technotes/tools/share/jstack.html
Thank you all!!