Monday, September 24, 2012

pSCP and getting CIsco IOS on Cisco routers.

I had a great time with pSCP failing to copy an image to an ASR1000 Cisco router recently.

The router was setup to allow SCP- basically setup aaa so the local or remote has exec and enable etc. and turn on the SCP server with the command "ip scp server enable).  Full document here:  http://www.cisco.com/en/US/docs/ios/12_2t/12_2t2/feature/guide/ftscp.html.

I was trapped on a windows jump box with pSCP instead of scp from the openssh stuff like Linux or OS X.  Which is fine, but maybe the logging would have been easier.  But my pscp kept failing.  Turned on logging on the router and the client and only got this obscure message:

SSH-4-SSH2_UNEXPECTED_MSG: Unexpected message type has arrived. Terminating the connection

Hmmm... so the secret is pSCP did not default to actual SCP.  Here is the command line that got me over:

pscp -scp -2 c2951-universalk9-mz.SPA.152-4.M1.bin username@192.168.1.1:flash0:/c2951-universalk9-mz.SPA.152-4.M1.bin


Seriously had to force scp and ssh v2 with the two switches at the beginning. The rest is as you'd expect source, target username@host:location.  Crazy.  Apparently it was trying to use sftp.  Good to know that the utility can do that as well, but it is called pscp- wouldn't the default be scp?  Maybe something in the negotiation.  I don't know.  That was an extra hour of my day that I hope I'm saving you next time.




1 comment:

Unknown said...

Thank you man! You save my hour or may be few hour of my life!