PSCP error: 'ssh_init: Network error: Cannot assign requested address'

34396 views
Skip to first unread message

Matt Miller

unread,
Nov 8, 2015, 8:13:26 PM11/8/15
to
Hello All,

I am using PSCP to transfer a file from a Linux server to a local directory on my Windows 7 machine. When I attempt to transfer the file using PSCP from the Windows command line, I immediately receive the error: 'ssh_init: Network error: Cannot assign requested address'. Putty works fine, WinSCP also works fine.

PSCP was working fine up to a few days ago, then suddenly stopped working. I have verified that I can perform a file transfer with a different Windows box using PSCP, so it definitely seems to be something about the PC itself that has changed. Could this be a configuration issue? How about something with my NIC card?

Any thoughts are much appreciated!

Thanks,

M. Miller

Jacob Nevins

unread,
Nov 11, 2015, 5:16:56 AM11/11/15
to
Matt Miller <matthew.al...@gmail.com> writes:
>I am using PSCP to transfer a file from a Linux server to a local
>directory on my Windows 7 machine. When I attempt to transfer the file
>using PSCP from the Windows command line, I immediately receive the
>error: 'ssh_init: Network error: Cannot assign requested address'.
>Putty works fine, WinSCP also works fine.

A favourite way to provoke this message is to try to connect to port 0.

Guess: is it possible that you've accidentally saved port 0 to PuTTY's
Default Settings? The different PuTTY tools have different implicit
session loading behaviour, which might explain why PuTTY works but PSCP
doesn't.

Matt Miller

unread,
Nov 16, 2015, 10:54:33 AM11/16/15
to
Thank you so much - you just saved me a ton of work!! That was it...I have several saved sessions which are correctly configured for port 22 (these are the sessions I regularly use with Putty), but somehow the default setting for the port got set to blank (zero). Once I changed it back to 22 I was able to PSCP and transfer files normally. What a stupid mistake on my part. I was prepared to go scorched-earth and replace the entire pc since this is a production-down situation for me.

Thanks again!
-Matt

erikeb...@gmail.com

unread,
Jul 5, 2020, 1:01:48 PM7/5/20
to
Saved my butt too, thanks guys. I got around this by adding the -P flag to specify port 22 directly. Then it worked fine.

EB

jcharl...@gmail.com

unread,
Jul 9, 2020, 4:00:32 PM7/9/20
to
Thanks guys... Even though my PuTTY default session still shows port 22, I was having this problem and used the -P flag to get pscp to work.

david....@gmail.com

unread,
Jul 11, 2020, 6:23:13 PM7/11/20
to
Just happened to me, so thanks for the explanation.

Putty recently got a version bump to 0.74 on my system. Wondering if this is a bug/revision or an issue with the upgrade process.

Just in case someone is chasing this down: Win10 1909. pscp/putty 0.74 installed/upgraded via Chocolatey

Option "-P 22" got the script running again.

And because it was likely a default setting issue, my subsequent run WITHOUT "-P 22" also worked as before.

asifel...@gmail.com

unread,
Jul 11, 2020, 10:51:49 PM7/11/20
to
On Sunday, July 5, 2020 at 10:31:48 PM UTC+5:30, erikeb...@gmail.com wrote:
> Saved my butt too, thanks guys. I got around this by adding the -P flag to specify port 22 directly. Then it worked fine.
>
> EB

Thanks. pscp -P 22 user@IP:file C:/User/location works perfectly.

Ziwen Yuan

unread,
Jul 16, 2020, 9:45:47 PM7/16/20
to
Thanks! Finally found answer here!

veg...@gmail.com

unread,
Jul 24, 2020, 7:06:15 PM7/24/20
to
Thank you Matt for asking the question and Jacob for providing the solution.
I just added "-P 22" in the command line and we are back in business. :)

clou...@gmail.com

unread,
Jul 31, 2020, 6:23:13 AM7/31/20
to
Hey, thanks Jacob you saved my whole day.

Mittu Chowdary

unread,
Aug 16, 2020, 5:25:21 AM8/16/20
to
Thanks a lot to you both. It saved me!! "pcsp -P 22 ...." worked!!

urooj mughal

unread,
Aug 21, 2020, 10:06:10 AM8/21/20
to
On Sunday, August 16, 2020 at 2:25:21 AM UTC-7, Mittu Chowdary wrote:
> Thanks a lot to you both. It saved me!! "pcsp -P 22 ...." worked!!
Hey, i am using pscp command for copy file from window to server. i have also issue but when i am using -P 22 port than also faced error: FATAL ERROR: Network error: connection refused .

Hassan Mkhlalati

unread,
Aug 26, 2020, 2:14:04 PM8/26/20
to
Thank you, Very good but how to make it permanent

Nathan Lannine

unread,
Aug 27, 2020, 2:53:17 PM8/27/20
to
> Thank you, Very good but how to make it permanent

I found just opening the putty settings window, highlighting the "default settings" entry, and clicking "save" fixed it for me. 22 was already in the port field for SSH.

Manfred Andres

unread,
Sep 15, 2020, 2:34:53 AM9/15/20
to
Nathan Lannine schrieb am Donnerstag, 27. August 2020 um 20:53:17 UTC+2:
> > Thank you, Very good but how to make it permanent
> I found just opening the putty settings window, highlighting the "default settings" entry, and clicking "save" fixed it for me. 22 was already in the port field for SSH.
Thank you very much. This made it permanent for me.

evindr...@gmail.com

unread,
Sep 22, 2020, 7:02:49 PM9/22/20
to
I'm still stuck on this.Could you share the solution to this problem?'

Giovanni Uzzardi

unread,
Sep 24, 2020, 12:24:53 PM9/24/20
to
Thank you!

Lapi Pase

unread,
Feb 9, 2021, 4:36:48 PM2/9/21
to
Perfect for AWS with pscp -P 22 -I ec2-user . Thanks a LOT !!

Anders Eliasson

unread,
Jun 9, 2021, 4:27:34 AM6/9/21
to
torsdag 27 augusti 2020 kl. 20:53:17 UTC+2 skrev Nathan Lannine:
> > Thank you, Very good but how to make it permanent
> I found just opening the putty settings window, highlighting the "default settings" entry, and clicking "save" fixed it for me. 22 was already in the port field for SSH.
Works for me too, "highlighting the "default settings" entry, and clicking "save" fixed it" No need to add -p after this. Thx :-)
Reply all
Reply to author
Forward
0 new messages