On Mon, 4 Oct 2004, Chris Devers wrote:

On Mon, 4 Oct 2004, John wrote:

Can i define a different port than 22 ?

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.

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

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>




Reply via email to