Networking

Fatal: Received unexpected end-of-file from server

Got this error today while using PSCP. I was attempting to move a file from my local computer to a remote server that allows only SCP Transfer Protocol. This was the command I was using:


pscp SampleProject\target\SampleProject.war devesh_sharma@192.11.23.157:/tmp

Digging a little bit into the issue, I found that since I intend to use SCP Transfer Protocol to transfer the file to the remote server, I need to explicitly specify the SCP protocol. I changed my command to the one below, and it worked like charm.


pscp -scp SampleProject\target\SampleProject.war devesh_sharma@192.11.23.157:/tmp

Please note the ‘-scp’ in the command. This ‘-scp’ forces the PSCP to use the SCP Transfer Protocol. If not specified explicitly, the PSCP will attempt to use the SFTP Protocol by default.

Networking

Transferring files to a remote server using PSCP

PSCP is a PuTTY Secure Copy client to securely transfer files between computers using an SSH connection.

1. Download the latest version of PSCP from the PuTTY Download Page.

2. Copy the downloaded ‘pscp.exe’ file to ‘C:\Windows’ directory.

3. Open the command prompt.

4. Now you are all set to transfer the files to the remote server. The syntax to use pscp command is as follows:


pscp [options] username1@source_host:directory1/filename1 username2@destination_host:directory2/filename2

For example, if I want to move a file from my local computer to the ‘tmp’ folder on a remote server, the command will look like:


pscp -scp SampleProject\target\SampleProject.war devesh_sharma@192.11.23.157:/tmp

Please note the ‘-scp’ in the command. This ‘-scp’ forces the PSCP to use the SCP Transfer Protocol.

If not specified explicitly, the PSCP will attempt to use the SFTP Protocol.

The SFTP protocol can also be forced using ‘-sftp’ in the command.