pscp – ssh_init: Network error: Cannot assign requested address

The PuTTY suite includes two programs for copying your files securely between machines. PSCP is a noninteractive program much like scp, and PSFTP is an interactive program inspired by ftp. You can use pscp (secure copy) and psftp (secure FTP) at the Windows XP Command Prompt. To copy a file with pscp, use:

pscp username @ host:path"

For example:

pscp file.txt geek@www.example.com:MyDocuments/.

I was playing around with pscp and encounted with an error:

ssh_init: Network error: Cannot assign requested address

1. It looks like pscp is using port 0 by default and mentioning the port allowed copying the file.

C:\temp>pscp myfie.txt oracle@10.10.10.11:/home/test/
ssh_init: Network error: Cannot assign requested address

2. So I tries to provide the port number on the command line with “-P” option:

C:\temp>pscp -P 22 myfie.txt oracle@10.10.10.11:/home/test/
The server's host key is not cached in the registry. You
have no guarantee that the server is the computer you
think it is.
The server's ssh-ed25519 key fingerprint is:
ssh-ed25519 255 45:35:11:23:5d:10:e2:e3:60:6a:c9:06:bb:74:ad:34
If you trust this host, enter "y" to add the key to
PuTTY's cache and carry on connecting.
If you want to carry on connecting just once, without
adding the key to the cache, enter "n".
If you do not trust this host, press Return to abandon the
connection.
Store key in cache? (y/n) yes
oracle@10.10.10.11's password:
myfie.txt                 | 0 kB |   0.0 kB/s | ETA: 00:00:00 | 100%
C:\temp>

It worked.

Conclusion

If you are going to copy files from Linux “down” to your Windows system, you need a program that will run on Windows. The creator of PuTTY made PSCP.EXE for precisely that purpose: to implement scp for Windows.

Related Post