0

I need to connect to linux,run script which requires sudo.

now i am trying this way:

plink.exe -ssh -pw mypassword -noagent myname@10.111.11.123 "sudo /var/squid/myscript.sh

in linux i added in /etc/sudoers file:

 myname  ALL=(ALL) NOPASSWD: /var/squid/myscript.sh

and

chown u+x /var/squid/myscript.sh

the script inside:

#!/bin/bash
touch testfile.txt

When i run the script from linux console:

sudo /var/squid/myscript.sh

it works with no password, but when i try to do it from remote windows using plink.exe it does not work. Any ideas ?

3

Ok, everything works fine - had to add -t in plink so now it should be:

plink.exe -ssh -pw mypassword -t myname@10.111.11.123 "sudo /var/squid/myscript.sh"

Thanks for help

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.