List Info

Thread: Methods that works to SSH and sudo.




Methods that works to SSH and sudo.
user name
2007-01-30 09:41:33
Guys,

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/"
instead "/".

My connection string:
$ssh = Net::SSH::Perl->new($host,
                              cipher =>
Net::SSH::Perl::Cipher::name(3),
                              port=>$port || 'ssh',
                              interactive=>1,
                              use_pty=>1,
                              protocol=>2,
                              debug=>0) or erro;
$ssh->login($user, $pass);
-----

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!





Unsubscribing info is here: h
ttp://help.yahoo.com/help/us/groups/groups-32.html 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://g
roups.yahoo.com/group/perl-beginner/

<*> Your email settings:
    Individual Email | Traditional

<*> To change settings online go to:
    http
://groups.yahoo.com/group/perl-beginner/join
    (Yahoo! ID required)

<*> To change settings via email:
    mailto:perl-beginner-digest@yahoogroups.com 
    mailto:perl-beginner-fullfeatured@yahoogroups.com

<*> To unsubscribe from this group, send an email to:
    perl-beginner-unsubscribe@yahoogroups.com

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.c
om/info/terms/
 

[1]

about | contact  Other archives ( Real Estate discussion Medical topics )