1

I am using Cygwin on Windows 7. I have installed OpenSSH client and i am using it connect to Ubuntu server installed on virtualbox through localhost. I am connecting through ssh with this command:

ssh -p 3022 [email protected]

But when I try to use the same command to connect through sftp I get this message:

ssh: Could not resolve hostname 3022: Name or service not known
Connection closed

The command I am using is this

sftp -p 3022 [email protected]

Any idea why I am able to connect through ssh but not through sftp?

1 Answer 1

1

Because with sftp, the -p switch has a different meaning. It means "always preserve times". It's an argument-less switch, so the following 3022 is interpreted as a standalone argument (=host name).

To set a custom port, use -P switch (capital P), supported by OpenSSH 5.4p1 and newer:

sftp -P 3022 [email protected]

With older versions of OpenSSH use:

sftp -o Port=3022 [email protected]

Beware that in some older versions of OpenSSH, the -P had yet another meaning.

0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .