in reply to Using Net::OpenSSH to su commands
$expect->send("$command\n");
A better approach is to tell su to run the command directly using the -c flag:
my ($pty, $pid) = $ssh->open2pty({stderr_to_stdout => 1}, 'su', '-c', +$command) or die "Can't open PTY: $!\n";
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Using Net::OpenSSH to su commands
by aztlan667 (Novice) on Mar 06, 2014 at 19:15 UTC |