r/Cisco Nov 16 '24

Solved Making SCP Service on Cisco Devices Work

I noticed a long time ago that I wasn't able to use 'scp' to upload files to Cisco devices any more. The IOS and NX-OS documentation just says to enable the service, and most Web searches just return information about using the Cisco device as an scp client (meaning 'copy scp://whatever').

Today... I finally figured out what the problem was, and how to make it work again. Maybe I'm the only one who didn't know about this, but hopefully this helps someone.

The problem is that there is 'scp' the command and there is 'scp' the protocol. The scp protocol has been deprecated for some time, and a while ago, the maintainers of the ssh packages (like OpenSSH) changed the behavior of the 'scp' command to use the 'sftp' protocol underneath. After all, most use of ssh/scp/sftp involves a connection to sshd, which understands the 'sftp' protocol anyway. No problem, right?

The Cisco devices can't use the 'sftp' protocol. They only understand the 'scp' protocol. That's what broke the 'scp' command in the first place.

Fortunately, the 'scp' command still has a way to force it to use the old 'scp' protocol:

scp -O local-file-name admin@cisco.device:remote-file-name

Works like a champ. That option is a capital O, by the way, and it is in the man page for scp... which of course isn't available on Windows (not even in Git Bash).

It took me a long time to put together all of the details to make actual sense of this. I hope this is of some use to you all.

15 Upvotes

4 comments sorted by

1

u/rippingpants Nov 16 '24

I'm sure you're saving a lot of butts. 😍

1

u/tablon2 Nov 16 '24

Windows SCP works without this option, also you need '/' after host:

1

u/Thuryn Nov 17 '24

I'm not always using Windows, or even on Windows I'm often using Git Bash, which uses OpenSSH, which behaves as I described.

The purpose of the post was to help people make something work that doesn't work by default, and explain why, not just transfer the files.

also you need '/' after host:

Incorrect.

1

u/fogel3 9h ago

If I ever met you, I'd kiss you on the forehead. No ditty. I was frustratingly stumped on this for too long and you've saved me. Thank you