Errors SCP

nc: invalid option -- 'X'

You are trying to send a file over scp

scp file andrei@192.168.56.117:/home/andrei/

And you get an error

nc: invalid option -- 'X' Ncat: Try `--help' or man(1) ncat for more information, usage options and help. QUITTING. ssh_exchange_identification: Connection closed by remote host lost connection

If you are a beginner, this message may surprise you - what is the connection here? It all comes down to netcat

However, if you run the same command with the vvv options (Verbose - that is, detailed log output)

scp -vvv file andrei@192.168.56.117:/home/andrei/

Executing: program /usr/bin/ssh host 192.168.56.117, user andrei, command scp -v -t /home/andrei/ OpenSSH_7.4p1, OpenSSL 1.0.2k-fips 26 Jan 2017 debug1: Reading configuration data /etc/ssh/ssh_config debug1: /etc/ssh/ssh_config line 58: Applying options for * debug1: /etc/ssh/ssh_config line 70: Applying options for * debug1: Executing proxy command: exec nc -X connect -x 192.168.56.103:1080 192.168.56.117 22 debug1: key_load_public: No such file or directory debug1: identity file /home/andrei/.ssh/bastion_key type -1 debug1: key_load_public: No such file or directory debug1: identity file /home/andrei/.ssh/bastion_key-cert type -1 debug1: Enabling compatibility mode for protocol 2.0 debug1: Local version string SSH-2.0-OpenSSH_7.4 debug1: permanently_drop_suid: 1000 nc: invalid option -- 'X' Ncat: Try `--help' or man(1) ncat for more information, usage options and help. QUITTING. ssh_exchange_identification: Connection closed by remote host lost connection

Article author: Andrei Olegovich