I need to be able:
- establish ssh connection to a server
- sudo to another user (sudo su - owner_user). In some cases prompt
for passwords and others, no.
- run a process using owner_user
- and get results this execution.
I already try with:
Net::SSH::Perl - Always hang when I run sudo.
Another problem, looks like that session doesnt persist. Ex: I send a
command: "cd /" and after, send "pwd", im always get "/home/userdir/"
My connection string:
$ssh = Net::SSH::Perl->new($host,
cipher => Net::SSH::Perl::Cipher::name(3),
port=>$port || 'ssh',
debug=>0) or erro;
IPC::Session - WORKS REALLY GREAT... But I cant treat with password's
prompts. Im trying to treat login password. With "sudo" I get no
prompt to try expect. I need to be able to expect login password and
sudo password, if asked.
Expect - I had tried but no successful. I found some messy examples.
All sugestions will be welcome!