[Ssh-sftp-perl-users] Net::SSH::perl to chroot enviro
Brought to you by:
dbrobins
From: John F. <joh...@zn...> - 2004-06-02 23:09:13
|
I am trying to use the package to log into a server which uses chroot environments. As a person if I 'ssh -l username servername' I get dropped into the chroot environment. When I use the perl script I get dropped into the normal environment, as if the sudo line in .bash_profile had not run. when the source .bash_profile is the first command given to the ssh object, I get this debug text: <see below> and the second commend is never executed, the script hangs. It feels like the perl module enters through another mechanism than the standard command line ssh. Both servers are running Debian Woody. Any pointers much appreciated. John ### code ##### use strict; use diagnostics; use Net::SSH::Perl; my $cmd1 = "source /home/build/.bash_profile " ; my $cmd2 = "pwd" ; my $ssh = Net::SSH::Perl->new($host, debug => 1, protocol => 2); $ssh->login($user, $pass); my($out1, $err1, $exit1) = $ssh->cmd($cmd1); my($out2, $err2, $exit2) = $ssh->cmd($cmd2); #### debug message #### pt: Reading configuration data /root/.ssh/config pt: Reading configuration data /etc/ssh_config pt: Allocated local port 1023. pt: Connecting to nn.nn.nn.nn, port 22. pt: Remote protocol version 2.0, remote software version OpenSSH_3.0.2p1 Debian 1:3.0.2p1-9 pt: Net::SSH::Perl Version 1.23, protocol version 2.0. pt: No compat match: OpenSSH_3.0.2p1 Debian 1:3.0.2p1-9. pt: Connection established. pt: Sent key-exchange init (KEXINIT), wait response. pt: Algorithms, c->s: 3des-cbc hmac-sha1 none pt: Algorithms, s->c: 3des-cbc hmac-sha1 none pt: Entering Diffie-Hellman Group 1 key exchange. pt: Sent DH public key, waiting for reply. pt: Received host key, type 'ssh-dss'. pt: Host 'nnn.nnn.nn.nn' is known and matches the host key. pt: Computing shared secret key. pt: Verifying server signature. pt: Waiting for NEWKEYS message. pt: Enabling incoming encryption/MAC/compression. pt: Send NEWKEYS, enable outgoing encryption/MAC/compression. pt: Sending request for user-authentication service. pt: Service accepted: ssh-userauth. pt: Trying empty user-authentication request. pt: Authentication methods that can continue: publickey,password,keyboard-interactive. pt: Next method to try is publickey. pt: Next method to try is password. pt: Trying password authentication. pt: Login completed, opening dummy shell channel. pt: channel 0: new [client-session] pt: Requesting channel_open for channel 0. pt: channel 0: open confirm rwindow 0 rmax 16384 pt: Got channel open confirmation, requesting shell. pt: Requesting service shell on channel 0. pt: channel 1: new [client-session] pt: Requesting channel_open for channel 1. pt: Entering interactive session. pt: Sending command: source /home/build/.bash_profile pt: Requesting service exec on channel 1. pt: channel 1: open confirm rwindow 0 rmax 16384 -- ---------------------------------------------------- John P. Fisher at ZNYX Networks 805 683 1488 x 3245 joh...@zn... |