in reply to Re^7: Problem using Net::OpenSSH->capture to su to another user
in thread Problem using Net::OpenSSH->capture to su to another user
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?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^9: Problem using Net::OpenSSH->capture to su to another user
by salva (Canon) on Jun 04, 2014 at 14:43 UTC | |
by tim.culhane (Initiate) on Jun 05, 2014 at 10:25 UTC | |
by salva (Canon) on Jun 05, 2014 at 10:30 UTC | |
by tim.culhane (Initiate) on Jun 05, 2014 at 14:06 UTC | |
by salva (Canon) on Jun 05, 2014 at 14:26 UTC | |
| |
|
Re^9: Problem using Net::OpenSSH->capture to su to another user
by AppleFritter (Vicar) on Jun 24, 2014 at 09:58 UTC |