0

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

now i am trying this way:

plink.exe -ssh -pw mypassword -noagent [email protected] "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 ?

2

1 Answer 1

4

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

plink.exe -ssh -pw mypassword -t [email protected] "sudo /var/squid/myscript.sh"

Thanks for help

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .