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

now i am trying this way:

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

in linux i added in /etc/sudoers file:

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


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

the script inside:

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 ?


1 Answer 1


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

plink.exe -ssh -pw mypassword -t myname@ "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.