2

I'm trying to use psftp (for the first time -- latest and greatest PuTTY installed), to connect to one of my servers. I'll call it example.com. On said server, I have sshd listening on a non-standard port (say, 1234). This works fine, since I can connect via SSH (using PuTTY, or anything else):

 ssh -p 1234 <user name>@example.com

No problem.

But, when I try psftp (using what I think should be equivalent syntax

 open example.com -P 1234 -l <user name>

I get the following error message:

open: invalid port number

The psftp docs suggest I can use any port between 1 -> 65K or so, and I know port 1234 is valid (despite what psftp is telling me, since I can connect to said port using every other SFTP or SCP client I've tried), but just not psftp.

I must be missing something obvious?

Thanks in advance.

Martin Prikryl
  • 188,800
  • 56
  • 490
  • 992

1 Answers1

1

The syntax of the psftp open command is:

open [username@]hostname [port]

So in your case:

open username@example.com 1234

The syntax you have tried to use is psftp command-line syntax.

So alternatively, instead of the open, you can "open" the session right on the commandline using:

psftp example.com -P 1234 -l <user name>

It's similar as with OpenSSH ssh (there you also use commandline syntax).

Martin Prikryl
  • 188,800
  • 56
  • 490
  • 992
  • Thanks, that did the trick. For ssh I use ssh -p 1234 username@host.com, which works fine. Apparently, psftp doesn't like the '-p' in front of the port, whereas ssh requires it. Doesn't much matter -- be nice if everything used similar syntax. – Johnny Canuck Jul 10 '22 at 21:35