Hi ,
I am trying to run a command using the scriptable task which requires SU to root, I notice I can't sudo and then run the command since its not the same shell, so I tried using the sudo -S command that will pull the password from the stdout:
session.connectWithPassword(password);
System.log("Connected!");
var cmd="echo 123456 | sudo -S sed -i '
''s/export TMOUT=120/export TMOUT=2400/g'
'' /etc/profile";
System.log("Executing "cmd"");
session.executeCommand(cmd,false) ;
If I am running this command on the server itself its working perfect.
Any idea whay?
Thanks,
Avi