Professional Web Applications Themes

Net::SFTP and different port than 22 - PERL Beginners

Can i define a different port than 22 ?...

  1. #1

    Default Net::SFTP and different port than 22

    Can i define a different port than 22 ?
    John Guest

  2. #2

    Default Re: Net::SFTP and different port than 22

    On Mon, 4 Oct 2004, John wrote:
     

    I don't see anything about specifying a port in the Net::SFTP docs, but
    the underlying SSH protocol does provide support for this, so it should
    be possible.

    Have you tried specifying the port as part of the host name?

    my $sftp = Net::SFTP->new(my.host.org:2222);

    ?

    I don't actually know if that will work, but it's worth a try.



    --
    Chris Devers
    Chris Guest

  3. #3

    Default Re: Net::SFTP and different port than 22

    On Mon, 4 Oct 2004, Chris Devers wrote:
     
    >
    > I don't see anything about specifying a port in the Net::SFTP docs, but the
    > underlying SSH protocol does provide support for this, so it should be
    > possible.
    >
    > Have you tried specifying the port as part of the host name?
    >
    > my $sftp = Net::SFTP->new(my.host.org:2222);
    >
    > ?
    >
    > I don't actually know if that will work, but it's worth a try.[/ref]

    Actually, more specifically, Net::SFTP seems to build on Net::SSH::Perl,
    and that seems to have a Port option:

    Net::SSH::Perl->new($host, %params)

    To set up a new connection, call the new method, which connects to
    $host and returns a Net::SSH::Perl object.

    new accepts the following named parameters in %params:

    [....]

    * port

    The port of the sshd daemon to which you wish to connect; if not
    specified, this is assumed to be the default ssh port.

    <http://search.cpan.org/~drolsky/Net-SSH-Perl-1.25/lib/Net/SSH/Perl.pm#Net::SSH::Perl-%3Enew($host,_%25params)>

    So it might be possible to have something like this

    my $sftp = Net::SFTP->new(my.host.org, -port => 2222);

    ....or something along those lines.

    This is completely untested, but it looks like it may work.



    --
    Chris Devers
    Chris Guest

  4. #4

    Default Re: Net::SFTP and different port than 22

    I fixed that

    Here is the solution

    my $sftp = Net::SFTP->new($myhost, user=>"user", password=>"pass",
    debug=>0,ssh_args => [port =>145]) or die();




    ----- Original Message -----
    From: "Chris Devers" <com>
    To: "John" <uoi.gr>
    Cc: "Perl Beginners" <org>
    Sent: Monday, October 04, 2004 6:27 PM
    Subject: Re: Net::SFTP and different port than 22

     
    > >
    > > I don't see anything about specifying a port in the Net::SFTP docs, but[/ref][/ref]
    the 
    >
    > Actually, more specifically, Net::SFTP seems to build on Net::SSH::Perl,
    > and that seems to have a Port option:
    >
    > Net::SSH::Perl->new($host, %params)
    >
    > To set up a new connection, call the new method, which connects to
    > $host and returns a Net::SSH::Perl object.
    >
    > new accepts the following named parameters in %params:
    >
    > [....]
    >
    > * port
    >
    > The port of the sshd daemon to which you wish to connect; if not
    > specified, this is assumed to be the default ssh port.
    >
    >[/ref]
    <http://search.cpan.org/~drolsky/Net-SSH-Perl-1.25/lib/Net/SSH/Perl.pm#Net::
    SSH::Perl-%3Enew($host,_%25params)> 


    John Guest

Similar Threads

  1. How to set non-standard SFTP Port
    By ltoews73 in forum Macromedia Contribute Connection Administrtion
    Replies: 1
    Last Post: May 28th, 06:26 AM
  2. ? Moving from port 8500 to port 80 on XP
    By b1boogie in forum Coldfusion - Getting Started
    Replies: 3
    Last Post: February 27th, 12:19 AM
  3. Help with Net::SFTP when sftp on unix works.
    By Ree-Yees in forum PERL Modules
    Replies: 1
    Last Post: September 21st, 07:39 PM
  4. Net::SFTP port problem
    By Michael Ragsdale in forum PERL Modules
    Replies: 0
    Last Post: July 26th, 05:18 PM
  5. Replies: 2
    Last Post: September 15th, 08:36 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139