Putty: Network error : cannot assign requested address
One option is to specify the port directly with -P <port>
(e.g., -P 22
), per the docs:
https://the.earth.li/~sgtatham/putty/0.74/htmldoc/Chapter5.html#pscp-usage
It seems that the PuTTY UI displays the Port value as 22 by default, even if there is no "Default Settings" session stored in the registry, so it appears to be valid even though it is not. The fix for this is to launch PuTTY, select the "Default Settings" and then click Load/Save.
EDIT: This is a known bug in PuTTY 0.74 (https://www.chiark.greenend.org.uk/~sgtatham/putty/wishlist/pscp-port-0.html).
Related videos on Youtube
Pᴇʜ
Languages I speak: German, English, C#, SQL, php, js, (s)css, html5, VBA, PostScript, Adobe ExtendScript
Updated on June 04, 2022Comments
-
Pᴇʜ about 2 years
Hello I have written a macro to ssh to a server whose username and password are stored at A1 and B1 respectively. When the the macro gets invoked , putty throws error Network error : cannot assign requested address
Sub putty() Dim un As String, pwd As String, pcmd As String, pline As String Dim shellObj As Object, runCmd As Object, sOut As Object un = Range("A1").Value pwd = Range("B1").Value Set shellObj = CreateObject("WScript.Shell") pcmd = "C:\Program Files\PuTTY\putty.exe " & un & "@15.xx.xx.xx -pw " & pwd & " who" Set runCmd = shellObj.exec(pcmd) Set sOut = runCmd.StdOut While Not sOut.AtEndOfStream pline = sOut.ReadLine Debug.Print pline Wend End Sub
Is there any workaround for this.
-
Admin over 5 yearsI have put the snippet of the code
-
Pᴇʜ over 5 yearsWhat happens if you take the output of
Debug.Print pcmd
and copy it into your shell and execute it. Does it work or does it throw the same error? • Try to replace your putty part with"""C:\Program Files\PuTTY\putty.exe"" "
probably the space inProgram Files
is causing this issue. -
Admin over 5 yearsI got the same error after using this """C:\Program Files\PuTTY\putty.exe"" "
-
Pᴇʜ over 5 yearsThen answer my first question please.
-
Admin over 5 yearsYaa debug is also giving the same error.
-
Pᴇʜ over 5 yearsI was not asking if the debug gives an error I was asking if you get the same error when you take the result of
Debug.Print pcmd
and copy/past that into your shell and excecute it gives the same error in the shell? Can you please be more precise and confirm that? -
Admin over 5 yearscan we chat over gmail or skype ?
-
Admin over 5 yearsI executed the code till it takes username from A1 , its working absolutely fine, the problem is from where it takes password from B1, then putty throws the error cannot assign requested address
-