I have a remote linux system that I can connect to via ssh and public key and then execute the following command:
sudo jetty restart
This command on this system is configured to allow anyone to execute without the sudo password. I.e. the sudoers file probably looks something like this
%develop ALL = NOPASSWD: /opt/scripts/jetty
This is great as we can execute this script with elevated privileges while keeping everything else locked down. The problem is when trying to execute this command remotely, I am always asked for the sudo password.
me@home:~$ ssh -t -i ~/.ssh/identity [email protected] 'sudo jetty restart'
Password: .....? (I don't have the sudo password!)
Is there a way I can execute this command remotely?
Make sure sudo
is picking the right command; if there's a /usr/bin/jetty
or such, the sudoers rule won't match. (Note that your ~/.bashrc
and such files are ignored when using ssh <host> <command>
, so your $PATH
customizations never happen.)
sudo /opt/scripts/jetty restart
should work.
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments