ssh-sftp-perl-users Mailing List for Net::SSH and Net::SFTP - Perl modules (Page 9)
Brought to you by:
dbrobins
You can subscribe to this list here.
2003 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(1) |
Dec
(6) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2004 |
Jan
(4) |
Feb
(15) |
Mar
(13) |
Apr
(8) |
May
(5) |
Jun
(21) |
Jul
(4) |
Aug
(9) |
Sep
(11) |
Oct
(14) |
Nov
(15) |
Dec
(24) |
2005 |
Jan
(10) |
Feb
(20) |
Mar
(16) |
Apr
(10) |
May
(12) |
Jun
(16) |
Jul
(18) |
Aug
(21) |
Sep
(11) |
Oct
(19) |
Nov
(16) |
Dec
(9) |
2006 |
Jan
(17) |
Feb
(32) |
Mar
(60) |
Apr
(21) |
May
(24) |
Jun
(1) |
Jul
(6) |
Aug
(18) |
Sep
(4) |
Oct
(9) |
Nov
(31) |
Dec
(10) |
2007 |
Jan
(8) |
Feb
(11) |
Mar
(3) |
Apr
(7) |
May
(4) |
Jun
(6) |
Jul
(7) |
Aug
(3) |
Sep
(2) |
Oct
(5) |
Nov
(5) |
Dec
(5) |
2008 |
Jan
(12) |
Feb
(5) |
Mar
(7) |
Apr
(4) |
May
(37) |
Jun
(9) |
Jul
(24) |
Aug
(5) |
Sep
(2) |
Oct
(7) |
Nov
(6) |
Dec
(7) |
2009 |
Jan
(18) |
Feb
(9) |
Mar
(14) |
Apr
(14) |
May
(1) |
Jun
(14) |
Jul
(4) |
Aug
(6) |
Sep
(4) |
Oct
(12) |
Nov
(4) |
Dec
|
2010 |
Jan
|
Feb
(3) |
Mar
|
Apr
(1) |
May
(4) |
Jun
|
Jul
(6) |
Aug
(6) |
Sep
|
Oct
(7) |
Nov
(2) |
Dec
(5) |
2011 |
Jan
(2) |
Feb
|
Mar
|
Apr
(1) |
May
(8) |
Jun
(1) |
Jul
|
Aug
(2) |
Sep
|
Oct
(4) |
Nov
(9) |
Dec
(7) |
2012 |
Jan
(1) |
Feb
(19) |
Mar
(4) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2013 |
Jan
|
Feb
|
Mar
(2) |
Apr
(2) |
May
|
Jun
(5) |
Jul
(3) |
Aug
(1) |
Sep
|
Oct
|
Nov
(6) |
Dec
|
2014 |
Jan
(7) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(1) |
Sep
|
Oct
|
Nov
|
Dec
|
2015 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(1) |
Dec
|
2016 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(1) |
Aug
|
Sep
|
Oct
(1) |
Nov
|
Dec
|
2018 |
Jan
|
Feb
|
Mar
(1) |
Apr
|
May
|
Jun
(1) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Vikas P. <vik...@ya...> - 2009-01-26 13:07:03
|
Hello Everyone I need one help. I need to pass command line parameter to another program. But the parameters are such that first parameter is individual then an array then again single parameter. Means there are three parameters first is a variable which I can store but after that there are two parameters which are part of an array and then again single variable. Do you have any idea how it can be achieved. Something like as shown below first variable then an array containing 2 variable then 3rd variable Var1 Var2 1) date 2) nos Var3 Thanks in Advance Vikas Poonia |
From: Ken B. <ken...@co...> - 2009-01-24 15:41:40
|
-----Original Message----- From: Ken Bassford [mailto:ken...@co...] Sent: Friday, January 23, 2009 20:36 To: 'Heiko Jansen' Subject: RE: [Ssh-sftp-perl-users] Having problems with compiling Net::SSH2 Hi Heiko, We finally managed to get it working, but it took running the -MCPAN... to get it to install. Despite what the documentation says, the autoinstall grabbed a whole bunch of other modules, various Crypt modules, BigInt etc.. Must have been about twenty in all. I'm using Perl 5.8.5, so I didn't need the patch you recommended. Got my first script running, while writing and testing the various features of SSH2 out, I found it to be a little idiosyncratic. Scripts that only require one command to be run remotely work very well with the exec and read commands, but the read and write commands don't like shell at all. Found that just shoving stuff up and down the pipe worked better. Also watch out for the timeouts, on a slow network connection the "while <$channel>" method will return before it receives a response. Tried to find a way that I could detect the response before trying to pull the bits back (the debug setting indicated that there was an libssh2 flag indicating bits were waiting, but I could not find the "poll" setting for it; and yes I tried looking at "poll->revents->in"). I finally just brute forced it by encapsulating make my read routine in another while loop that would take the number of seconds (times 4 for the standard 250 msec. timeout) and reenter that number of times, unless it received a response, when it would just break out of the loop. Works great for multi-line responses. Also, while I was messing around with the poll settings, I had to set the poll setting every time I wanted to issue or receive a command or they reverted back to their default values, unless I'm missing something. Thanks for the help. Sincerely, Ken -----Original Message----- From: Heiko Jansen [mailto:ja...@hb...] Sent: Monday, January 19, 2009 15:22 To: ssh...@li... Subject: Re: [Ssh-sftp-perl-users] Having problems with compiling Net::SSH2 Am Freitag, den 16.01.2009, 19:56 -0500 schrieb Ken Bassford: > I'm trying to get Net::SSH2 to run on a base load, RHEL3.1 system. I > tried doing the following steps in order, all without the slightest > hint of an error until the final step. > > 1. "make" && "make test" && "make install" on zlib 1.2.3 source > 2. "make" && "make test" && "make install" on OpenSSL 0.9.8j > source > 3. "./configure -with-zlib -with OpenSSL " &&, "make" && "make > test" (or possibly check, whatever the instructions said to > do) && "make install" on libssh2-1.0 source > 4. ran "perl Makefile.PL" && "make" without error on > Net-SSH2-0.18 source > 5. ran "make test" and got two compile errors that it could not > find two OpenSSL .h files (sorry, the system I did this on is > at work, so I'm relaying this from memeory). > > > > My question is, "Do I have to revert to the libssh2-0.12 source for > Net-SSH2-0.18 to work, or has anyone gotten it to work with more > recent builds of libssh2?" It works for me with libssh2-0.18 (as far as I remember Net-SSH2-0.18 was released to address changes therein) and libssh2-1.0, both on Solaris 10 (64Bit) and Linux (32 and 64Bit). I have not tested with OpenSSL 0.9.8j (0.9.8h was the latest I used, I think, on one of the installations). If you use Perl 5.10 you need to patch Net::SSH2 (cf. http://rt.cpan.org/Ticket/Display.html?id=37045) but it does not sound as if you were running into that problem. Never saw anything like what you describe ("could not find two OpenSSL .h files during 'make test'"). Heiko Besuchen Sie das hbz auf der Bielefeld Conference vom 3. bis 5. Februar an Stand 7 ! |
From: Nigel R. <ni...@sy...> - 2009-01-23 22:28:52
|
I'm having some issues getting connected to some of our machines how I have a test script running. Maybe I don't have the right set of keys that'll work with Net::SSH:Perl but I'd like that confirmed if possible. Running ssh -v to connect I get the following output OpenSSH_4.3p2-hpn, OpenSSL 0.9.7i 14 Oct 2005 HP-UX Secure Shell-A.04.30.006, HP-UX Secure Shell version debug1: Reading configuration data /opt/ssh/etc/ssh_config debug1: Connecting to xxxxxx[xx.xx.xx.xx] port 22. debug1: fd 4 clearing O_NONBLOCK debug1: Connection established. debug1: read PEM private key done: type DSA debug1: read PEM private key done: type RSA debug1: permanently_set_uid: 0/3 debug1: identity file /root/.ssh/identity type 1 debug1: identity file /root/.ssh/id_rsa type 1 debug1: identity file /root/.ssh/id_dsa type 2 debug1: Remote protocol version 2.0, remote software version OpenSSH_4.3p2-hpn debug1: match: OpenSSH_4.3p2-hpn pat OpenSSH* debug1: Enabling compatibility mode for protocol 2.0 debug1: Local version string SSH-2.0-OpenSSH_4.3p2-hpn debug1: SSH2_MSG_KEXINIT sent debug1: SSH2_MSG_KEXINIT received debug1: kex: server->client aes128-cbc hmac-md5 none debug1: kex: client->server aes128-cbc hmac-md5 none debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<1024<8192) sent debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP debug1: SSH2_MSG_KEX_DH_GEX_INIT sent debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY debug1: Host 'xxxxxxx' is known and matches the RSA host key. debug1: Found key in /root/.ssh/known_hosts:67 debug1: ssh_rsa_verify: signature correct debug1: SSH2_MSG_NEWKEYS sent debug1: expecting SSH2_MSG_NEWKEYS debug1: SSH2_MSG_NEWKEYS received debug1: SSH2_MSG_SERVICE_REQUEST sent debug1: SSH2_MSG_SERVICE_ACCEPT received Then I get the MOTD from the server. Now with Net::SSH::Perl... yyyyyy: Reading configuration data /.ssh/config yyyyyy: Reading configuration data /etc/ssh_config yyyyyy: Allocated local port 1023. yyyyyy: Connecting to xxxxxx, port 22. yyyyyy: Remote protocol version 2.0, remote software version OpenSSH_4.3p2-hpn yyyyyy: Net::SSH::Perl Version 1.33, protocol version 2.0. yyyyyy: No compat match: OpenSSH_4.3p2-hpn. yyyyyy: Connection established. yyyyyy: Sent key-exchange init (KEXINIT), wait response. yyyyyy: Algorithms, c->s: 3des-cbc hmac-sha1 none yyyyyy: Algorithms, s->c: 3des-cbc hmac-sha1 none yyyyyy: Entering Diffie-Hellman Group 1 key exchange. yyyyyy: Sent DH public key, waiting for reply. yyyyyy: Received host key, type 'ssh-dss'. yyyyyy: Host 'xxxxxx' is known and matches the host key. yyyyyy: Computing shared secret key. yyyyyy: Verifying server signature. yyyyyy: Waiting for NEWKEYS message. yyyyyy: Enabling incoming encryption/MAC/compression. yyyyyy: Send NEWKEYS, enable outgoing encryption/MAC/compression. yyyyyy: Sending request for user-authentication service. yyyyyy: Service accepted: ssh-userauth. yyyyyy: Trying empty user-authentication request. yyyyyy: Authentication methods that can continue: publickey,password,keyboard-interactive. yyyyyy: Next method to try is publickey. yyyyyy: Publickey: testing agent key '/home/reedn2/.ssh/id_rsa' yyyyyy: Authentication methods that can continue: publickey,password,keyboard-interactive. yyyyyy: Next method to try is publickey. yyyyyy: Trying pubkey authentication with key file '/root/.ssh/id_dsa' yyyyyy: Authentication methods that can continue: publickey,password,keyboard-interactive. yyyyyy: Next method to try is publickey. yyyyyy: Next method to try is password. yyyyyy: Trying password authentication. yyyyyy: Will not query passphrase in batch mode. yyyyyy: Authentication methods that can continue: publickey,password,keyboard-interactive. yyyyyy: Next method to try is publickey. yyyyyy: Publickey: testing agent key '/home/reedn2/.ssh/id_rsa' yyyyyy: Authentication methods that can continue: publickey,password,keyboard-interactive. yyyyyy: Next method to try is publickey. yyyyyy: Trying pubkey authentication with key file '/root/.ssh/id_dsa' yyyyyy: Authentication methods that can continue: publickey,password,keyboard-interactive. yyyyyy: Next method to try is publickey. yyyyyy: Next method to try is password. yyyyyy: Trying password authentication. yyyyyy: Will not query passphrase in batch mode. yyyyyy: Authentication methods that can continue: publickey,password,keyboard-interactive. yyyyyy: Next method to try is publickey. yyyyyy: Publickey: testing agent key '/home/reedn2/.ssh/id_rsa' Received disconnect message: Too many authentication failures for root at /opt/perl_32/lib/site_perl/5.8.8/Net/SSH/Perl/AuthMgr.pm line 143 TIA, Nigel -- Nigel Reed President & CEO Sysadmin, Inc 972 673 4199 http://www.sysadmininc.com Toastmasters District 50 Vista Division Governor 2008-2009 Awareness, Attitude and Action bring Achievement! |
From: Nigel R. <ni...@sy...> - 2009-01-23 18:34:44
|
Hi all. When I try to connect to a host that ssh isn't running on, for some reason, I am getting the following: Can't connect to xxxxxxx, port 22: Connection refused at /opt/perl_32/lib/site_perl/5.8.8/Net/SSH/Perl.pm line 205. How do I go about trapping that error that the script just continues or I continues in another direction? Thanks, Nigel -- Nigel Reed President & CEO Sysadmin, Inc 972 673 4199 http://www.sysadmininc.com Toastmasters District 50 Vista Division Governor 2008-2009 Awareness, Attitude and Action bring Achievement! |
From: Howard, C. <Ho...@pr...> - 2009-01-23 18:09:29
|
I embedded the path on the remote end into the "put" destination parameter That seems to work. Also, I uploaded my sample script to the list. Let me know if you want me to send it direct also. Chris -----Original Message----- From: DiOrio, Dominick [mailto:dom...@cg...] Sent: Friday, January 23, 2009 10:31 AM To: ssh...@li... Cc: DiOrio, Dominick Subject: [Ssh-sftp-perl-users] sftp perl not working Hi, I an trying to script sftp using perl and I can not get the commands to work, I am new to SFTP. Dose any body have a working script to change working dir and ftp files. Here are the command that I can not get to work. The error is always connection closed yet when I they check the server it say I am logon on and active. my $sftp=Net::SFTP->new("hostname",user=>"xxxxxxxx", password=>"xxxxxxxx"); $sftp->cwd("newdir"); $sftp->put("datafile") or die "could not ftp the file to new server \n"; Thanks Dominick |
From: DiOrio, D. <dom...@cg...> - 2009-01-23 17:43:17
|
Hi, I an trying to script sftp using perl and I can not get the commands to work, I am new to SFTP. Dose any body have a working script to change working dir and ftp files. Here are the command that I can not get to work. The error is always connection closed yet when I they check the server it say I am logon on and active. my $sftp=Net::SFTP->new("hostname",user=>"xxxxxxxx", password=>"xxxxxxxx"); $sftp->cwd("newdir"); $sftp->put("datafile") or die "could not ftp the file to new server \n"; Thanks Dominick |
From: Nigel R. <ni...@sy...> - 2009-01-23 17:08:41
|
Hi there, I am going to loop through a number of servers using Net::SSH::Perl. I haven't seen anything about logging out. Is there a way to explicitly logout of a server before I continue to the next one or are logouts done automatically? I assume it's possible to have multiple ssh connections open at once. Thanks, Nigel -- Nigel Reed President & CEO Sysadmin, Inc 972 673 4199 http://www.sysadmininc.com Toastmasters District 50 Vista Division Governor 2008-2009 Awareness, Attitude and Action bring Achievement! |
From: Howard, C. <Ho...@pr...> - 2009-01-22 18:47:19
|
And here is my sample script, just in case anybody would find it useful. I use a file in this user's home directory to contain the host, username, and password. If you do that make sure the file has pretty tight filesystem permissions. #!/usr/bin/perl # # $ftp_data_file = $ENV{'HOME'}.'/ftpdata'; # For awhile we will keep a log of what is happening open(LOG,">>/tmp/SAMPLE_upload.log"); print LOG "--------------\n"; open(FTP_DATA,$ftp_data_file) || print LOG "unable to open ftp data file $ftp_data_file\n"; while(<FTP_DATA>) { next if ( m/^\s*#/ ); ($key,$value) = split(); $ftp_data{$key} = $value; } # # open an ftp connection using # 'SAMPLE_host', 'SAMPLE_user', 'SAMPLE_password' # from the ftp_data hash # $now_string = localtime(); print LOG "Starting $now_string \n"; if( !defined($ftp_data{'SAMPLE_host'}) || !defined($ftp_data{'SAMPLE_user'}) || !defined($ftp_data{'SAMPLE_password'}) ) { # don't even try print LOG "file $ftp_data doesn't have what we need!\n"; exit 1; } use Net::SFTP; $now_string = localtime(); printf LOG "\tsftp: Starting $now_string \n"; my %args = (ssh_args => []); $args{debug} = 1; $args{user} = $ftp_data{'SAMPLE_user'}; $args{password} = $ftp_data{'SAMPLE_password'}; $sftp = Net::SFTP->new($ftp_data{'SAMPLE_host'},%args); if(! $sftp ) { print LOG "failed: connection to host $ftp_data{'SAMPLE_host'}\n"; } else { $herename = $ARGV[0]; $therename = $ARGV[1]; printf LOG "sending file %s to %s\n", $herename, $therename; if(! $sftp->put($herename,$therename) ) { print LOG "failed: put $herename to $therename\n"; } else { printf LOG "sent file %s to %s\n", $herename, $therename; } } $now_string = localtime(); print LOG "\tftp: Finished $now_string \n"; exit 0; -----Original Message----- From: Howard, Chris Sent: Thursday, January 22, 2009 11:29 AM To: Howard, Chris; ssh...@li... Subject: RE: [Ssh-sftp-perl-users] help needed with SFTP followup to myself: I think I have the basic script working ok now. |
From: Howard, C. <Ho...@pr...> - 2009-01-22 18:28:56
|
followup to myself: I think I have the basic script working ok now. I wrestled with my own syntax problems but I believe I have tamed the "put" issue and have my file appearing on the remote server at the proper place. I still would like some guidance on if it is possible to skip through some of the login negotiation. Chris -----Original Message----- From: Howard, Chris [mailto:Ho...@pr...] Sent: Thursday, January 22, 2009 10:14 AM To: ssh...@li... Subject: [Ssh-sftp-perl-users] help needed with SFTP Hello, I am attemping to write a simple perl script to upload a file to a remote site using sftp. I am used to Net::FTP so my script follows along similar lines. I think that lack of sophistication is probably a large part of my problem! Problem #1: running a small test script with debug turned on I see that my login sequence gets held up for quite awhile before finally saying "Entering Diffie-Hullman Group 1 key exchange". Then it moves along and gets me logged in with my username and password. Is there any way to avoid the long delay? Problem #2: I need to change directory on the remote machine and then upload my file. I cannot find any "cd" type of command. I have attempted to use the full pathname in the "put", but that also seems to not be working as I expect. Does anyone have a simple example of logging in with a name and password, navigating to a directory, uploading/downloading a file? Chris ------------------------------------------------------------------------ ------ This SF.net email is sponsored by: SourcForge Community SourceForge wants to tell your story. http://p.sf.net/sfu/sf-spreadtheword _______________________________________________ Ssh-sftp-perl-users mailing list Ssh...@li... https://lists.sourceforge.net/lists/listinfo/ssh-sftp-perl-users |
From: Howard, C. <Ho...@pr...> - 2009-01-22 17:26:12
|
Hello, I am attemping to write a simple perl script to upload a file to a remote site using sftp. I am used to Net::FTP so my script follows along similar lines. I think that lack of sophistication is probably a large part of my problem! Problem #1: running a small test script with debug turned on I see that my login sequence gets held up for quite awhile before finally saying "Entering Diffie-Hullman Group 1 key exchange". Then it moves along and gets me logged in with my username and password. Is there any way to avoid the long delay? Problem #2: I need to change directory on the remote machine and then upload my file. I cannot find any "cd" type of command. I have attempted to use the full pathname in the "put", but that also seems to not be working as I expect. Does anyone have a simple example of logging in with a name and password, navigating to a directory, uploading/downloading a file? Chris |
From: Heiko J. <ja...@hb...> - 2009-01-19 20:39:23
|
Am Freitag, den 16.01.2009, 19:56 -0500 schrieb Ken Bassford: > I’m trying to get Net::SSH2 to run on a base load, RHEL3.1 system. I > tried doing the following steps in order, all without the slightest > hint of an error until the final step. > > 1. “make” && “make test” && “make install” on zlib 1.2.3 source > 2. “make” && “make test” && “make install” on OpenSSL 0.9.8j > source > 3. “./configure –with-zlib –with OpenSSL “ &&, “make” && “make > test” (or possibly check, whatever the instructions said to > do) && “make install” on libssh2-1.0 source > 4. ran “perl Makefile.PL” && “make” without error on > Net-SSH2-0.18 source > 5. ran “make test” and got two compile errors that it could not > find two OpenSSL .h files (sorry, the system I did this on is > at work, so I’m relaying this from memeory). > > > > My question is, “Do I have to revert to the libssh2-0.12 source for > Net-SSH2-0.18 to work, or has anyone gotten it to work with more > recent builds of libssh2?” It works for me with libssh2-0.18 (as far as I remember Net-SSH2-0.18 was released to address changes therein) and libssh2-1.0, both on Solaris 10 (64Bit) and Linux (32 and 64Bit). I have not tested with OpenSSL 0.9.8j (0.9.8h was the latest I used, I think, on one of the installations). If you use Perl 5.10 you need to patch Net::SSH2 (cf. http://rt.cpan.org/Ticket/Display.html?id=37045) but it does not sound as if you were running into that problem. Never saw anything like what you describe ("could not find two OpenSSL .h files during 'make test'"). Heiko Besuchen Sie das hbz auf der Bielefeld Conference vom 3. bis 5. Februar an Stand 7 ! |
From: Ken B. <ken...@co...> - 2009-01-17 18:27:23
|
Hi Folks, I think that Rodney's looking for something a little more basic. There are at least 10 variations on doing what you want, some better than others. This is one way I commonly use. #! /usr/bin/perl -w for $arg(@ARGV) { if ($arg eq "-a") { $length = shift(@ARGV); } elsif ($arg eq "-b") { $width = shift(@ARGV); } elsif ($arg eq "-ab") { $height = shift(@ARGV); } else { # include any error handling here! } } # Next, check to see if your parameters are all present and in the correct range! # Error handling is always a good practice. Hope this helps. Sincerely, Ken |
From: Ken B. <ken...@co...> - 2009-01-17 00:56:11
|
Hi Folks, I'm trying to get Net::SSH2 to run on a base load, RHEL3.1 system. I tried doing the following steps in order, all without the slightest hint of an error until the final step. 1. "make" && "make test" && "make install" on zlib 1.2.3 source 2. "make" && "make test" && "make install" on OpenSSL 0.9.8j source 3. "./configure -with-zlib -with OpenSSL " &&, "make" && "make test" (or possibly check, whatever the instructions said to do) && "make install" on libssh2-1.0 source 4. ran "perl Makefile.PL" && "make" without error on Net-SSH2-0.18 source 5. ran "make test" and got two compile errors that it could not find two OpenSSL .h files (sorry, the system I did this on is at work, so I'm relaying this from memeory). My question is, "Do I have to revert to the libssh2-0.12 source for Net-SSH2-0.18 to work, or has anyone gotten it to work with more recent builds of libssh2?" Thanks in advance, Ken |
From: Ivaylo T. <iva...@gm...> - 2009-01-15 15:44:38
|
Hi, I am using following code to connect to Juniper router: my $ssh = Net::SSH::Perl->new($ip, protocol => 2); $ssh->login($user, $pass); foreach (@commands) { my($out, $err, $exit) = $ssh->cmd($_); } but seems that every command in @commands is transmitted in a separate socket connection than the previous despite that the protocol is SSH2. What can I do to send all commands in one single socket connection ? Thank you in advance. |
From: Rodney R. <rri...@gm...> - 2009-01-12 05:59:32
|
use the Getopt::Long perl module, its included with the base modules. Rodney On Sun, Jan 11, 2009 at 9:40 PM, Vikas Poonia <vik...@ya...>wrote: > Hello Sir/Madam > > I need to pass argument in perl script something like as > ./perlprogramname -a length -b width -ab height > > if anyone have idea how this can be achieved? > > Thanks in Advance > Vikas > > > > ------------------------------------------------------------------------------ > Check out the new SourceForge.net Marketplace. > It is the best place to buy or sell services for > just about anything Open Source. > http://p.sf.net/sfu/Xq1LFB > _______________________________________________ > Ssh-sftp-perl-users mailing list > Ssh...@li... > https://lists.sourceforge.net/lists/listinfo/ssh-sftp-perl-users > > |
From: Vikas P. <vik...@ya...> - 2009-01-12 04:40:35
|
Hello Sir/Madam I need to pass argument in perl script something like as ./perlprogramname -a length -b width -ab height if anyone have idea how this can be achieved? Thanks in Advance Vikas |
From: Yun Z. <vi...@gm...> - 2009-01-08 16:28:29
|
Hi, I try to use Net::SSH2 to execute command on remote shell, and I use channel shell. I need to wait for the end of the command executed on remote shell and then run the next step. How could I do that? Thanks & Best Regards Vivian Zhang |
From: Kilaru R. c. <kil...@gm...> - 2009-01-06 07:00:09
|
Hi Please click on the link below and enter your birthday into my calendar. It's quick, easy, and you'll be helping me out. http://www.birthdayalarm.com/bd2/32773631a768693082b1444358458c319392566d1386 Kilaru |
From: Kevin M. <kmc...@ba...> - 2008-12-21 04:08:21
|
David M. Funk wrote: > Try Net-SSH2 > Thanks, it looks like Net::SSH2 does the trick. Took a bit to figure out that I needed to set blocking to 0. Kinda wish there was a more concise way to run a single command out of Net::SSH2 itself, but I guess I just wrap that up in my own module :) my $out = ''; if ($ssh2->auth_password($username,$password)) { my $chan = $ssh2->channel(); $chan->exec('ls'); $chan->blocking(0); while (my $line = <$chan>) { $out .= $line; } } print $out; > -----Original Message----- > From: Kevin McGrath [mailto:kmc...@ba...] > Sent: Saturday, December 20, 2008 1:27 PM > To: ssh...@li... > Subject: [Ssh-sftp-perl-users] Net::SSH::Perl cmd() hangs in mod_perl2 > > Anyone using Net::SSH::Perl under mod_perl2? I can't seem to get cmd() > to work within a mod_perl2 environment. I have the following code: > > my $ssh = Net::SSH::Perl->new($hostname); > $ssh->login($user, $password); > my($stdout, $stderr, $exit) = $ssh->cmd('ls'); > > Which works everywhere except if I'm in a mod_perl2 environment. If > turn debugging on I get the following output at which point it hangs > indefinitely: > > server1: Reading configuration data /.ssh/config > server1: Reading configuration data /etc/ssh_config > server1: Connecting to server2, port 22. > server1: Remote protocol version 2.0, remote software version OpenSSH_3.9p1 > server1: Net::SSH::Perl Version 1.33, protocol version 2.0. > server1: No compat match: OpenSSH_3.9p1. > server1: Connection established. > server1: Sent key-exchange init (KEXINIT), wait response. > server1: Algorithms, c->s: 3des-cbc hmac-sha1 none > server1: Algorithms, s->c: 3des-cbc hmac-sha1 none > server1: Entering Diffie-Hellman Group 1 key exchange. > server1: Sent DH public key, waiting for reply. > server1: Received host key, type 'ssh-dss'. > server1: Host 'server2' is known and matches the host key. > server1: Computing shared secret key. > server1: Verifying server signature. > server1: Waiting for NEWKEYS message. > server1: Enabling incoming encryption/MAC/compression. > server1: Send NEWKEYS, enable outgoing encryption/MAC/compression. > server1: Sending request for user-authentication service. > server1: Service accepted: ssh-userauth. > server1: Trying empty user-authentication request. > server1: Authentication methods that can continue: publickey,password. > server1: Next method to try is publickey. > server1: Trying pubkey authentication with key file '/var/www/.ssh/id_dsa' > server1: Will not query passphrase for '/var/www/.ssh/id_dsa' in batch mode. > server1: Loading private key failed. > server1: Next method to try is password. > server1: Trying password authentication. > server1: Login completed, opening dummy shell channel. > server1: channel 0: new [client-session] > server1: Requesting channel_open for channel 0. > server1: channel 0: open confirm rwindow 0 rmax 32768 > server1: Got channel open confirmation, requesting shell. > server1: Requesting service shell on channel 0. > server1: channel 1: new [client-session] > server1: Requesting channel_open for channel 1. > server1: Entering interactive session. > server1: Sending command: ls > server1: Requesting service exec on channel 1. > server1: channel 1: open confirm rwindow 0 rmax 32768 > server1: input_channel_request: rtype exit-status reply 0 > server1: channel 1: rcvd eof > server1: channel 1: output open -> drain > server1: channel 1: rcvd close > server1: channel 1: input open -> closed > server1: channel 1: close_read > > ----HANGS FOREVER---- > > > ---------------------------------------------------------------------------- > -- > _______________________________________________ > Ssh-sftp-perl-users mailing list > Ssh...@li... > https://lists.sourceforge.net/lists/listinfo/ssh-sftp-perl-users > > |
From: David M. F. <mf...@tr...> - 2008-12-20 20:49:42
|
Try Net-SSH2 -----Original Message----- From: Kevin McGrath [mailto:kmc...@ba...] Sent: Saturday, December 20, 2008 1:27 PM To: ssh...@li... Subject: [Ssh-sftp-perl-users] Net::SSH::Perl cmd() hangs in mod_perl2 Anyone using Net::SSH::Perl under mod_perl2? I can't seem to get cmd() to work within a mod_perl2 environment. I have the following code: my $ssh = Net::SSH::Perl->new($hostname); $ssh->login($user, $password); my($stdout, $stderr, $exit) = $ssh->cmd('ls'); Which works everywhere except if I'm in a mod_perl2 environment. If turn debugging on I get the following output at which point it hangs indefinitely: server1: Reading configuration data /.ssh/config server1: Reading configuration data /etc/ssh_config server1: Connecting to server2, port 22. server1: Remote protocol version 2.0, remote software version OpenSSH_3.9p1 server1: Net::SSH::Perl Version 1.33, protocol version 2.0. server1: No compat match: OpenSSH_3.9p1. server1: Connection established. server1: Sent key-exchange init (KEXINIT), wait response. server1: Algorithms, c->s: 3des-cbc hmac-sha1 none server1: Algorithms, s->c: 3des-cbc hmac-sha1 none server1: Entering Diffie-Hellman Group 1 key exchange. server1: Sent DH public key, waiting for reply. server1: Received host key, type 'ssh-dss'. server1: Host 'server2' is known and matches the host key. server1: Computing shared secret key. server1: Verifying server signature. server1: Waiting for NEWKEYS message. server1: Enabling incoming encryption/MAC/compression. server1: Send NEWKEYS, enable outgoing encryption/MAC/compression. server1: Sending request for user-authentication service. server1: Service accepted: ssh-userauth. server1: Trying empty user-authentication request. server1: Authentication methods that can continue: publickey,password. server1: Next method to try is publickey. server1: Trying pubkey authentication with key file '/var/www/.ssh/id_dsa' server1: Will not query passphrase for '/var/www/.ssh/id_dsa' in batch mode. server1: Loading private key failed. server1: Next method to try is password. server1: Trying password authentication. server1: Login completed, opening dummy shell channel. server1: channel 0: new [client-session] server1: Requesting channel_open for channel 0. server1: channel 0: open confirm rwindow 0 rmax 32768 server1: Got channel open confirmation, requesting shell. server1: Requesting service shell on channel 0. server1: channel 1: new [client-session] server1: Requesting channel_open for channel 1. server1: Entering interactive session. server1: Sending command: ls server1: Requesting service exec on channel 1. server1: channel 1: open confirm rwindow 0 rmax 32768 server1: input_channel_request: rtype exit-status reply 0 server1: channel 1: rcvd eof server1: channel 1: output open -> drain server1: channel 1: rcvd close server1: channel 1: input open -> closed server1: channel 1: close_read ----HANGS FOREVER---- ---------------------------------------------------------------------------- -- _______________________________________________ Ssh-sftp-perl-users mailing list Ssh...@li... https://lists.sourceforge.net/lists/listinfo/ssh-sftp-perl-users |
From: Kevin M. <kmc...@ba...> - 2008-12-20 20:19:46
|
Anyone using Net::SSH::Perl under mod_perl2? I can't seem to get cmd() to work within a mod_perl2 environment. I have the following code: my $ssh = Net::SSH::Perl->new($hostname); $ssh->login($user, $password); my($stdout, $stderr, $exit) = $ssh->cmd('ls'); Which works everywhere except if I'm in a mod_perl2 environment. If turn debugging on I get the following output at which point it hangs indefinitely: server1: Reading configuration data /.ssh/config server1: Reading configuration data /etc/ssh_config server1: Connecting to server2, port 22. server1: Remote protocol version 2.0, remote software version OpenSSH_3.9p1 server1: Net::SSH::Perl Version 1.33, protocol version 2.0. server1: No compat match: OpenSSH_3.9p1. server1: Connection established. server1: Sent key-exchange init (KEXINIT), wait response. server1: Algorithms, c->s: 3des-cbc hmac-sha1 none server1: Algorithms, s->c: 3des-cbc hmac-sha1 none server1: Entering Diffie-Hellman Group 1 key exchange. server1: Sent DH public key, waiting for reply. server1: Received host key, type 'ssh-dss'. server1: Host 'server2' is known and matches the host key. server1: Computing shared secret key. server1: Verifying server signature. server1: Waiting for NEWKEYS message. server1: Enabling incoming encryption/MAC/compression. server1: Send NEWKEYS, enable outgoing encryption/MAC/compression. server1: Sending request for user-authentication service. server1: Service accepted: ssh-userauth. server1: Trying empty user-authentication request. server1: Authentication methods that can continue: publickey,password. server1: Next method to try is publickey. server1: Trying pubkey authentication with key file '/var/www/.ssh/id_dsa' server1: Will not query passphrase for '/var/www/.ssh/id_dsa' in batch mode. server1: Loading private key failed. server1: Next method to try is password. server1: Trying password authentication. server1: Login completed, opening dummy shell channel. server1: channel 0: new [client-session] server1: Requesting channel_open for channel 0. server1: channel 0: open confirm rwindow 0 rmax 32768 server1: Got channel open confirmation, requesting shell. server1: Requesting service shell on channel 0. server1: channel 1: new [client-session] server1: Requesting channel_open for channel 1. server1: Entering interactive session. server1: Sending command: ls server1: Requesting service exec on channel 1. server1: channel 1: open confirm rwindow 0 rmax 32768 server1: input_channel_request: rtype exit-status reply 0 server1: channel 1: rcvd eof server1: channel 1: output open -> drain server1: channel 1: rcvd close server1: channel 1: input open -> closed server1: channel 1: close_read ----HANGS FOREVER---- |
From: Jeremy K. <ki...@sc...> - 2008-12-17 18:52:41
|
Jeremy Kitchen wrote: > Jeremy Kitchen wrote: >> Is there some step I'm missing to make this work how I want? > > so I figured out part of this. > > I apparently need to disable blocking on the channel for this to work > properly. Since I'm executing multiple commands, I have to re-enable > blocking to set up a new channel, then disable blocking to work with the > channel. This is an ok solution, but it doesn't seem quite right.. I > still feel as though I'm doing something wrong. > > Additionally, now I'm getting the 'in' events I want, except when I go > to read, there's nothing there. Also, I'm not getting 'err' events > (stderr) nor is there anything to read there. > > Any help would be greatly appreciated! anyone? -Jeremy |
From: Sylvan K. <js...@sa...> - 2008-12-04 15:17:10
|
After successfully establishing a SSH connection I use the following code snippet, variations of which have been posted many places. my $chan = $ssh2->channel(); $chan->shell(); $chan->blocking(0); my ($len, $buf); $chan->write("ls\n"); select(undef,undef,undef,0.25); print $buf while (($len = $chan->read($buf,512)) > 0); I get an error message "Use of uninitialized value in numeric gt (>) at SFTP_test2.pl line 21" which is the print statement print $buf while (($len = $chan->read($buf,512)) > 0); If I turn on debugging ($ssh->debug(1)). I get the following output libssh2_channel_open_ex(ss->session, pv_channel_type, len_channel_type, window_size, packet_size, ((void *)0) , 0 ) -> 0x1ca3ecc Net::SSH2::Channel::read(size = 512, ext = 0) mail mbox Network Trash Folder Private user vsite web - read 54 bytes - read -37 bytes - read 54 total Net::SSH2::Channel::read(size = 512, ext = 0) - read -37 bytes Use of uninitialized value in numeric gt (>) at SFTP_test2.pl line 21. Net::SSH2::Channel::DESTROY Net::SSH2::DESTROY object 0x19a4c9c Lines 3-9 is the 'ls' output I am looking for so I know it is in the channel. What is causing the error "Use of uninitialized value in numeric gt (>)" from the statement print $buf while (($len = $chan->read($buf,512)) > 0); Thanks |
From: Jeremy K. <ki...@sc...> - 2008-12-02 19:06:08
|
Jeremy Kitchen wrote: > Is there some step I'm missing to make this work how I want? so I figured out part of this. I apparently need to disable blocking on the channel for this to work properly. Since I'm executing multiple commands, I have to re-enable blocking to set up a new channel, then disable blocking to work with the channel. This is an ok solution, but it doesn't seem quite right.. I still feel as though I'm doing something wrong. Additionally, now I'm getting the 'in' events I want, except when I go to read, there's nothing there. Also, I'm not getting 'err' events (stderr) nor is there anything to read there. Any help would be greatly appreciated! -Jeremy |
From: Jeremy K. <ki...@sc...> - 2008-12-02 06:17:31
|
I'm trying to write a quick program which will execute a series of commands on the remote system and get each individual exit status back from the commands. It appears the way to go about doing this is to create a new channel, exec, get the exit status, destroy the channel, exec, get the exit status, etc. However, I *also* want to grab the output of these commands (stdout and stderr) in real time, so I'm trying to use poll. Now, I could be going about this completely the wrong way. If I am, please let me know :) $channel->shell doesn't seem like it fits for me as I don't think I can get the exit statuses back from the remote commands being run. Here's a bit of what I have so far (which isn't working): my $channel = $ssh->channel; $channel->exec("sleep 5 && echo 'moo' && sleep 1"); print "\n"; while (1) { print "loop\n"; my @poll = ({handle => $channel, events => ['in','err']}); if ($ssh->poll(500, \@poll)) { # handle events } print Dumper($poll[0]->{revents}); } everything is all well and good until the command finishes (after the sleep 5), when polling completely blocks. Nothing further ever happens. If I kill the remote sshd process handling the connection (the user@notty process) then it returns these events: $VAR1 = { 'in' => 1, 'value' => 129, 'listener_closed' => 1, 'channel_closed' => 1 }; Is there some step I'm missing to make this work how I want? -Jeremy |