From Linux command shell I can make SSH connection to our CentOS machine using user ABC
. After successful SSH connection, I can run sudo
command and no password is required.
sudo /usr/bin/rootsh -i -u root
In JSch program, I make am SSH connection using user ABC
and then execute the above command, but it asks me:
[sudo] password for [**ABC**]
I am opening a channel using the following code:
session.openChannel("exec");
I do not understand why it asks for password even no password is required. Also it asks password for ABC
, but in my sudo
command I have specified user root
.
How can I solve this problem?