Hi, Have a need to run the below command as a "karuser" from a java class which will is running as "root" user. When we are trying to run the below command from java code getting the below error.
Hi, Our system administrator informed that this ption can not be disabled due to security issues. Other than disabling 'requiretty' is there anyway to make this command work?
If sudo needs a password, then it needs a tty, sure.
But sudo also complains, when it doesn't need a password, because NOPASSWD is in effect. Just had that situation a few days ago. And the reason for this is the requiretty setting in the sudoers file afaik.
ssh user@host sudo.. -> complaint,
ssh -t user@host sudo... -> success without asking for a password,
removing requiretty and ssh user@host sudo.. -> success
It's an either-or thing, sure. It might require a TTY for either reason. But if it requires a password, you can get a confusing error about no TTY, because it needs a TTY to ask for a password...
You see similar things when ssh complains about not having an askpass program available. The error isn't actually the lack of an askpass program, of course; the error is that it needs to ask for a password and can't...
No mention of password prompting here so it looks like you must be on a tty with this.
Note that the requiretty default requirement could be relaxed just for your particular script (/bank/karunix/bin/build_cycles.sh), so no need to open everything else up.