Re: [Ssh-sftp-perl-users] Using Net::SSH2 as a file handle
Brought to you by:
dbrobins
From: Bryan B. <br...@bu...> - 2006-01-20 14:50:59
|
>> I dont fully understand channels, but from what I remember with >> Net::SSH::Perl, a new channel had to be created every time you sent a >> command. But now there is a Net::SSH2::Channel->shell() function, >> perhaps >> there is a way to launch a shell on a channel and interact with that? > > There is. The shell() function just makes the channel a shell channel, > and you can send commands to it. > Does this act like a normal shell? Primarily does it just exec shell and pass IO back and forth, or is it interpreted somehow? >> I see Net::SSH2::Channel is itself a tied filehandle, but attempts to >> directly manipulate that dont result in what I expected. > > In what way? If you can give details I'll try to fix them. > > -- > Dave > Isa. 40:31 > With this snipit of code: -- snip --> use Net::SSH2; use Expect; my $ssh2 = Net::SSH2->new(); $ssh2->connect("127.0.0.1"); $ssh2->auth(username => scalar getpwuid($<), interact => 1) or die; my $chan = $ssh2->channel(); $chan->shell(); my $exp_obj = Expect->exp_init( $chan ); <-- end -- Returns the following when I run the script: $ ./test.pl [user username] Password: ERROR: cannot find method `FILENO' in class Expect at ./test3.pl line 13 Line 13 is the expect init line. Maybe its an expect bug, but I dont think so. I've been able to open expect on raw sockets before. So i think it has something to do with the way channel() sets itself up. Thanks. Bryan http://sourceforge.net/projects/rove |