Thread: [Ssh-sftp-perl-users] Net::SFTP and publickey
Brought to you by:
dbrobins
From: Jim M. <jim...@no...> - 2004-08-13 18:00:06
|
Hi I'm trying to setup a connection using publickeys, but I'm getting nowhere. I have a publickey in /export/home/jimmatt/.ssh/id_rsa. Here's the code: $sftp = Net::SFTP->new($server, ssh_args=>[port => "22"]); $sftp->get($remote_file, $localfile); Nothing fancy. Here's the output I get: morpheus: Reading configuration data /export/home/jimmatt/.ssh/config morpheus: Reading configuration data /etc/ssh_config morpheus: Connecting to test.duke.edu, port 22. morpheus: Remote protocol version 2.0, remote software version OpenSSH_3.8p1 morpheus: Net::SSH::Perl Version 1.25, protocol version 2.0. morpheus: No compat match: OpenSSH_3.8p1. morpheus: Connection established. morpheus: Sent key-exchange init (KEXINIT), wait response. morpheus: Algorithms, c->s: 3des-cbc hmac-sha1 none morpheus: Algorithms, s->c: 3des-cbc hmac-sha1 none morpheus: Entering Diffie-Hellman Group 1 key exchange. morpheus: Sent DH public key, waiting for reply. morpheus: Received host key, type 'ssh-dss'. morpheus: Host 'test.duke.edu' is known and matches the host key. morpheus: Computing shared secret key. morpheus: Verifying server signature. morpheus: Waiting for NEWKEYS message. morpheus: Enabling incoming encryption/MAC/compression. morpheus: Send NEWKEYS, enable outgoing encryption/MAC/compression. morpheus: Sending request for user-authentication service. morpheus: Service accepted: ssh-userauth. morpheus: Trying empty user-authentication request. morpheus: Authentication methods that can continue: publickey,password,keyboard-interactive. morpheus: Next method to try is publickey. morpheus: Next method to try is password. morpheus: Trying password authentication. morpheus: Will not query passphrase in batch mode. morpheus: Authentication methods that can continue: publickey,password,keyboard-interactive. morpheus: Next method to try is publickey. morpheus: Next method to try is password. morpheus: Trying password authentication. morpheus: Will not query passphrase in batch mode. morpheus: Authentication methods that can continue: publickey,password,keyboard-interactive. morpheus: Next method to try is publickey. morpheus: Next method to try is password. morpheus: Trying password authentication. morpheus: Will not query passphrase in batch mode. morpheus: Authentication methods that can continue: publickey,password,keyboard-interactive. morpheus: Next method to try is publickey. morpheus: Next method to try is password. Permission denied at /usr/local/lib/perl5/site_perl/5.8.5/Net/SFTP.pm line 37 I tried to specify the the identity file by using: $sftp = Net::SFTP->new($server, debug=>true, ssh_args=>[identity_files => "/export/home/jimmatt/.ssh/id_rsa", port => "22"]); but it didn't like that: morpheus: Service accepted: ssh-userauth. morpheus: Trying empty user-authentication request. morpheus: Authentication methods that can continue: publickey,password,keyboard-interactive. morpheus: Next method to try is publickey. Can't use string ("/export/home/jimmatt/.ssh/id_rsa") as an ARRAY ref while "strict refs" in use at /usr/local/lib/perl5/site_perl/5.8.5/Net/SSH/Perl/Auth/PublicKey.pm line 51. Any other way to try and specify this? Thanks. --------------------- Jim Matthews ISS Systems Administrator Duke University - Perkins Library Box 90196 Durham, NC 27708 Email: jim...@du... Voice: 919-660-5963 Fax: 919-684-6990 |
From: Mark F. <mar...@ea...> - 2004-08-13 18:52:32
|
From: "Jim Matthews" <jim...@no...> >> Can't use string ("/export/home/jimmatt/.ssh/id_rsa") as an ARRAY ref > while "strict refs" in use at > /usr/local/lib/perl5/site_perl/5.8.5/Net/SSH/Perl/Auth/PublicKey.pm line > 51. You are trying to use what the Net::SFTP POD calls "ssh_args". (You're trying to pass args to SSH. Your example shows the port argument. I don't see where you pass "identity_files" argument, but that's what it's complaining about). The way to use "%args" is clear as *mud* and not in the SFTP documentation. This was discussed last April in archive article: http://sourceforge.net/mailarchive/message.php?msg_id=7695250 And prior to that in http://sourceforge.net/mailarchive/message.php?msg_id=7114677 To make it easier, I'll recreate it here. my $sftp = Net::SFTP->new("somehost.domain.domain", ( user => "someuser", ssh_args => ( ( [ port => (["1234"]), identity_files => ([ "/home/user/.ssh/ident_file" ]) ] ) ) ) ); Dave, here comes the rant which you should be expecting. You recall I discussed this with you almost a year ago. It took me 2 days of trial and error to unravel the undocumented syntax. I mentioned it again in January after you created the mailing list and asked everyone to re-input their requests and observations. Three months later (in April) another user tripped over this. Here we are again.... It would be so *easy* just to add an example near "ssh_args" in the POD. Nothing needs to be "fixed." Just the courtesy of saving people from a syntax they would never figure out. What's so hard about that? It's been requested three times over almost a year period. The last time I requested it, you complained that I hadn't opened a "RT" ticket (which you didn't mention the two previous times I requested it). I opened the RT (http://sourceforge.net/mailarchive/forum.php?thread_id=4169065&forum_id=365 14) and still no update of the POD. You've asked for contribututions back to the project. I've tried. Given the incomprehendability of "ssh_args" this should have been a welcome solution. A mere documentation update. Instead it's gone nowhere for almost 12 months despite 3 requests. I'm sorry complaining. But, I'm still frustrated over those two days I spent last year figuring out that notation. The example I provided could save someone else the same frustration. For the fourth time: Is there any possibility this example can be placed in the documentation? Thank you, Mark ----- Original Message ----- From: "Jim Matthews" <jim...@no...> To: <ssh...@li...> Sent: Friday, August 13, 2004 10:59 AM Subject: [Ssh-sftp-perl-users] Net::SFTP and publickey > Hi > > I'm trying to setup a connection using publickeys, but I'm getting > nowhere. I have a publickey in /export/home/jimmatt/.ssh/id_rsa. Here's > the code: > > $sftp = Net::SFTP->new($server, ssh_args=>[port => "22"]); > $sftp->get($remote_file, $localfile); > > Nothing fancy. Here's the output I get: > > morpheus: Reading configuration data /export/home/jimmatt/.ssh/config > morpheus: Reading configuration data /etc/ssh_config > morpheus: Connecting to test.duke.edu, port 22. > morpheus: Remote protocol version 2.0, remote software version > OpenSSH_3.8p1 > morpheus: Net::SSH::Perl Version 1.25, protocol version 2.0. > morpheus: No compat match: OpenSSH_3.8p1. > morpheus: Connection established. > morpheus: Sent key-exchange init (KEXINIT), wait response. > morpheus: Algorithms, c->s: 3des-cbc hmac-sha1 none > morpheus: Algorithms, s->c: 3des-cbc hmac-sha1 none > morpheus: Entering Diffie-Hellman Group 1 key exchange. > morpheus: Sent DH public key, waiting for reply. > morpheus: Received host key, type 'ssh-dss'. > morpheus: Host 'test.duke.edu' is known and matches the host key. > morpheus: Computing shared secret key. > morpheus: Verifying server signature. > morpheus: Waiting for NEWKEYS message. > morpheus: Enabling incoming encryption/MAC/compression. > morpheus: Send NEWKEYS, enable outgoing encryption/MAC/compression. > morpheus: Sending request for user-authentication service. > morpheus: Service accepted: ssh-userauth. > morpheus: Trying empty user-authentication request. > morpheus: Authentication methods that can continue: > publickey,password,keyboard-interactive. > morpheus: Next method to try is publickey. > morpheus: Next method to try is password. > morpheus: Trying password authentication. > morpheus: Will not query passphrase in batch mode. > morpheus: Authentication methods that can continue: > publickey,password,keyboard-interactive. > morpheus: Next method to try is publickey. > morpheus: Next method to try is password. > morpheus: Trying password authentication. > morpheus: Will not query passphrase in batch mode. > morpheus: Authentication methods that can continue: > publickey,password,keyboard-interactive. > morpheus: Next method to try is publickey. > morpheus: Next method to try is password. > morpheus: Trying password authentication. > morpheus: Will not query passphrase in batch mode. > morpheus: Authentication methods that can continue: > publickey,password,keyboard-interactive. > morpheus: Next method to try is publickey. > morpheus: Next method to try is password. > Permission denied at /usr/local/lib/perl5/site_perl/5.8.5/Net/SFTP.pm line > 37 > > I tried to specify the the identity file by using: > > $sftp = Net::SFTP->new($server, debug=>true, ssh_args=>[identity_files => > "/export/home/jimmatt/.ssh/id_rsa", port => "22"]); > > but it didn't like that: > > morpheus: Service accepted: ssh-userauth. > morpheus: Trying empty user-authentication request. > morpheus: Authentication methods that can continue: > publickey,password,keyboard-interactive. > morpheus: Next method to try is publickey. > Can't use string ("/export/home/jimmatt/.ssh/id_rsa") as an ARRAY ref > while "strict refs" in use at > /usr/local/lib/perl5/site_perl/5.8.5/Net/SSH/Perl/Auth/PublicKey.pm line > 51. > > Any other way to try and specify this? > > Thanks. > --------------------- > Jim Matthews > ISS Systems Administrator > Duke University - Perkins Library > Box 90196 > Durham, NC 27708 > Email: jim...@du... > Voice: 919-660-5963 > Fax: 919-684-6990 > > > ------------------------------------------------------- > SF.Net email is sponsored by Shop4tech.com-Lowest price on Blank Media > 100pk Sonic DVD-R 4x for only $29 -100pk Sonic DVD+R for only $33 > Save 50% off Retail on Ink & Toner - Free Shipping and Free Gift. > http://www.shop4tech.com/z/Inkjet_Cartridges/9_108_r285 > _______________________________________________ > Ssh-sftp-perl-users mailing list > Ssh...@li... > https://lists.sourceforge.net/lists/listinfo/ssh-sftp-perl-users |
From: Jim M. <jim...@no...> - 2004-08-13 21:19:48
|
Mark Thanks for the help. I was using the identity_files parameter, but my syntax was slightly off (I wasn't using brackets and parens around the name of the file). All fixed now. Sorry to stir up this trouble again. I saw your post previously and that's what lead me to figure out how to use the port parameter correctly (ssh doesn't live in /etc/services on my boxes). Thanks. --------------------- Jim Matthews ISS Systems Administrator Duke University - Perkins Library Box 90196 Durham, NC 27708 Email: jim...@du... Voice: 919-660-5963 Fax: 919-684-6990 "Mark Fuller" <mar...@ea...> 08/13/2004 02:52 PM Please respond to "Mark Fuller" <mar...@ea...> To <ssh...@li...>, "Jim Matthews" <jim...@no...> cc Subject Re: [Ssh-sftp-perl-users] Net::SFTP and publickey From: "Jim Matthews" <jim...@no...> >> Can't use string ("/export/home/jimmatt/.ssh/id_rsa") as an ARRAY ref > while "strict refs" in use at > /usr/local/lib/perl5/site_perl/5.8.5/Net/SSH/Perl/Auth/PublicKey.pm line > 51. You are trying to use what the Net::SFTP POD calls "ssh_args". (You're trying to pass args to SSH. Your example shows the port argument. I don't see where you pass "identity_files" argument, but that's what it's complaining about). The way to use "%args" is clear as *mud* and not in the SFTP documentation. This was discussed last April in archive article: http://sourceforge.net/mailarchive/message.php?msg_id=7695250 And prior to that in http://sourceforge.net/mailarchive/message.php?msg_id=7114677 To make it easier, I'll recreate it here. my $sftp = Net::SFTP->new("somehost.domain.domain", ( user => "someuser", ssh_args => ( ( [ port => (["1234"]), identity_files => ([ "/home/user/.ssh/ident_file" ]) ] ) ) ) ); Dave, here comes the rant which you should be expecting. You recall I discussed this with you almost a year ago. It took me 2 days of trial and error to unravel the undocumented syntax. I mentioned it again in January after you created the mailing list and asked everyone to re-input their requests and observations. Three months later (in April) another user tripped over this. Here we are again.... It would be so *easy* just to add an example near "ssh_args" in the POD. Nothing needs to be "fixed." Just the courtesy of saving people from a syntax they would never figure out. What's so hard about that? It's been requested three times over almost a year period. The last time I requested it, you complained that I hadn't opened a "RT" ticket (which you didn't mention the two previous times I requested it). I opened the RT ( http://sourceforge.net/mailarchive/forum.php?thread_id=4169065&forum_id=365 14) and still no update of the POD. You've asked for contribututions back to the project. I've tried. Given the incomprehendability of "ssh_args" this should have been a welcome solution. A mere documentation update. Instead it's gone nowhere for almost 12 months despite 3 requests. I'm sorry complaining. But, I'm still frustrated over those two days I spent last year figuring out that notation. The example I provided could save someone else the same frustration. For the fourth time: Is there any possibility this example can be placed in the documentation? Thank you, Mark ----- Original Message ----- From: "Jim Matthews" <jim...@no...> To: <ssh...@li...> Sent: Friday, August 13, 2004 10:59 AM Subject: [Ssh-sftp-perl-users] Net::SFTP and publickey > Hi > > I'm trying to setup a connection using publickeys, but I'm getting > nowhere. I have a publickey in /export/home/jimmatt/.ssh/id_rsa. Here's > the code: > > $sftp = Net::SFTP->new($server, ssh_args=>[port => "22"]); > $sftp->get($remote_file, $localfile); > > Nothing fancy. Here's the output I get: > > morpheus: Reading configuration data /export/home/jimmatt/.ssh/config > morpheus: Reading configuration data /etc/ssh_config > morpheus: Connecting to test.duke.edu, port 22. > morpheus: Remote protocol version 2.0, remote software version > OpenSSH_3.8p1 > morpheus: Net::SSH::Perl Version 1.25, protocol version 2.0. > morpheus: No compat match: OpenSSH_3.8p1. > morpheus: Connection established. > morpheus: Sent key-exchange init (KEXINIT), wait response. > morpheus: Algorithms, c->s: 3des-cbc hmac-sha1 none > morpheus: Algorithms, s->c: 3des-cbc hmac-sha1 none > morpheus: Entering Diffie-Hellman Group 1 key exchange. > morpheus: Sent DH public key, waiting for reply. > morpheus: Received host key, type 'ssh-dss'. > morpheus: Host 'test.duke.edu' is known and matches the host key. > morpheus: Computing shared secret key. > morpheus: Verifying server signature. > morpheus: Waiting for NEWKEYS message. > morpheus: Enabling incoming encryption/MAC/compression. > morpheus: Send NEWKEYS, enable outgoing encryption/MAC/compression. > morpheus: Sending request for user-authentication service. > morpheus: Service accepted: ssh-userauth. > morpheus: Trying empty user-authentication request. > morpheus: Authentication methods that can continue: > publickey,password,keyboard-interactive. > morpheus: Next method to try is publickey. > morpheus: Next method to try is password. > morpheus: Trying password authentication. > morpheus: Will not query passphrase in batch mode. > morpheus: Authentication methods that can continue: > publickey,password,keyboard-interactive. > morpheus: Next method to try is publickey. > morpheus: Next method to try is password. > morpheus: Trying password authentication. > morpheus: Will not query passphrase in batch mode. > morpheus: Authentication methods that can continue: > publickey,password,keyboard-interactive. > morpheus: Next method to try is publickey. > morpheus: Next method to try is password. > morpheus: Trying password authentication. > morpheus: Will not query passphrase in batch mode. > morpheus: Authentication methods that can continue: > publickey,password,keyboard-interactive. > morpheus: Next method to try is publickey. > morpheus: Next method to try is password. > Permission denied at /usr/local/lib/perl5/site_perl/5.8.5/Net/SFTP.pm line > 37 > > I tried to specify the the identity file by using: > > $sftp = Net::SFTP->new($server, debug=>true, ssh_args=>[identity_files => > "/export/home/jimmatt/.ssh/id_rsa", port => "22"]); > > but it didn't like that: > > morpheus: Service accepted: ssh-userauth. > morpheus: Trying empty user-authentication request. > morpheus: Authentication methods that can continue: > publickey,password,keyboard-interactive. > morpheus: Next method to try is publickey. > Can't use string ("/export/home/jimmatt/.ssh/id_rsa") as an ARRAY ref > while "strict refs" in use at > /usr/local/lib/perl5/site_perl/5.8.5/Net/SSH/Perl/Auth/PublicKey.pm line > 51. > > Any other way to try and specify this? > > Thanks. > --------------------- > Jim Matthews > ISS Systems Administrator > Duke University - Perkins Library > Box 90196 > Durham, NC 27708 > Email: jim...@du... > Voice: 919-660-5963 > Fax: 919-684-6990 > > > ------------------------------------------------------- > SF.Net email is sponsored by Shop4tech.com-Lowest price on Blank Media > 100pk Sonic DVD-R 4x for only $29 -100pk Sonic DVD+R for only $33 > Save 50% off Retail on Ink & Toner - Free Shipping and Free Gift. > http://www.shop4tech.com/z/Inkjet_Cartridges/9_108_r285 > _______________________________________________ > Ssh-sftp-perl-users mailing list > Ssh...@li... > https://lists.sourceforge.net/lists/listinfo/ssh-sftp-perl-users |
From: Chris L. <cp...@fa...> - 2004-09-16 14:43:57
|
Mark Fuller wrote: > The way to use "%args" is clear as *mud* and not > in the SFTP documentation. I was wrestling with the same lack of documentation today in a Net::SSH::Perl context. I came across your message which sorted me out fast. Thanks. I took your sample for Net::SFTP, and applied it thus: use Net::SSH::Perl; my $host = 'domain.com'; my $user = 'user'; my $pass = 'pass'; # not used during key-based auth my $debug = 0; my $port = 22; my $identity = '/path/to/.ssh/id_rsa'; my @ssh_args = ( debug => $debug, identity_files => ([$identity]), port => $ssh_port, ); my $command = 'uptime'; my $ssh = Net::SSH::Perl->new($host, @args); # key-based login: $ssh->login($user); # or password-based login: # $ssh->login($user, $pass); my ($stdout, $stderr, $exit) = $ssh->cmd($command); warn ("error performing command: $command ($stderr)") if ($exit); print $stdout; exit; Regards Chris Langlands -- Fast Media http://www.fastmedia.com/ |