Hi Salva,
If I try that I get the below output:
loguser@enflog01 check_apps$ echo <password> |ssh loguser@enfcdb01 "sudo -Sk -p '' -- su -lc ls imail"
sudo: sorry, you must have a tty to run sudo
tim
| [reply] |
oops, try again forcing a tty allocation!
echo $PASSWD |ssh -tt loguser@enfcdb01 "sudo -Sk -p '' -- su -lc ls im
+ail"
(BTW, you may like to remove the password from your previus post) | [reply] [d/l] |
Hi Salva,
That command sort of seems to work in that the 'ls' command works but there is still an error. I get:
loguser@enflog01 check_apps$ echo cIhyv46iPL8092t |ssh -tt loguser@enfcdb01 "sudo -Sk -p '' -- su -lc ls imail"
tcgetattr: Invalid argument
We trust you have received the usual lecture from the local System
Administrator. It usually boils down to these three things:
#1) Respect the privacy of others.
#2) Think before you type.
#3) With great power comes great responsibility.
Mx9.0 check_mx_config.sh etc include log perl sleepycat tmp
bin config examples lib man queue snmp upgrade
Connection to enfcdb01 closed.
I added a foreach statement in my code to see what was being returned for the capture call. The code is as follows.
<code>
my @out = $ssh->capture({ tty => 1, stdin_data => "$password\n" },
'sudo', '-Sk',
'-p', '',
'--',
'su -lc "ls" imail');
foreach (@out) {
print "the value of out is ". $_;
}
And the output is:
tcgetattr: Invalid argument
the value of out is
the value of out is We trust you have received the usual lecture from the local System
the value of out is Administrator. It usually boils down to these three things:
the value of out is
the value of out is #1) Respect the privacy of others.
the value of out is #2) Think before you type.
the value of out is #3) With great power comes great responsibility.
the value of out is
the value of out is
the value of out is sudo: su -lc "ls" imail: command not found
Not sure if this something to do with the shell not interpreting the command being sent?
| [reply] |