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 ?
Best Answer
Ok, everything works fine - had to add -t in plink so now it should be:
Thanks for help