Wednesday 10 September 2014

PSCP and an oddity of it (force it to use scp)


PSCP is a useful Windows SCP command line client; which tonight caught me out when working with OpernWRT. It doesn't just stick to SCP but wants to do SFTP too.

I was surprised when I connected using PSCP that my OpenWRT stated that it had been asked for SFTP. My request below was for a recursive copy of the OpenVPN certificates.

C:\Program Files (x86)\PuTTY>pscp -r root@192.168.1.254:/etc/easy-rsa/keys c:\certs
root@192.168.1.254's password:
ash: /usr/libexec/sftp-server: not found
Fatal: Received unexpected end-of-file from server

Testing within the OopenWRT router from and to itself worked fine.

root@OpenWrt:~# scp -r root@192.168.2.254:/etc/easy-rsa/keys/ ./
root@192.168.2.254's password:
index.txt

Looking at the command line options of PSCP, pscp /? I came across the argument -scp which forces PSCP to use SCP and not SFTP.

Solution

So it should look like this: 

>pscp -r -scp root@192.168.1.254:/etc/easy-rsa/keys c:\certs

C:\Program Files (x86)\PuTTY>pscp /?
PuTTY Secure Copy client
Release 0.63
Usage: pscp [options] [user@]host:source target
       pscp [options] source [source...] [user@]host:target
       pscp [options] -ls [user@]host:filespec
Options:
  -V        print version information and exit
  -pgpfp    print PGP key fingerprints and exit
  -p        preserve file attributes
  -q        quiet, don't show statistics
  -r        copy directories recursively
  -v        show verbose messages
  -load sessname  Load settings from saved session
  -P port   connect to specified port
  -l user   connect with specified username
  -pw passw login with specified password
  -1 -2     force use of particular SSH protocol version
  -4 -6     force use of IPv4 or IPv6
  -C        enable compression
  -i key    private key file for authentication
  -noagent  disable use of Pageant
  -agent    enable use of Pageant
  -batch    disable all interactive prompts
  -unsafe   allow server-side wildcards (DANGEROUS)
  -sftp     force use of SFTP protocol

  -scp      force use of SCP protocol


No comments:

Post a Comment