PSCP stands for PuTTY Secure Copy. It provides a secure connection to transfer files between the local PC and the remote server. It is the component of the PuTTY. PuTTY uses PSCP to transfer the files securely from remote server. It encrypts the data that transferred to prevent from the unauthorized access. It is an efficient tool specially designed for only secure file transfer with maintaining the high level of security.
Table of Contents
Download PSCP
PSCP is the element of PuTTY. It free and open source, anyone can download it independently. It is on the element of the PuTTY download package.
How to Open PSCP
Open PSCP, go to Start Menu then search command prompt and press enter.
On the command prompt type cd/path to pscp.exe, and replace the path with the exact location of the pscp file. Place the location that you set during the time of installing PuTTY. If you change the location then enter exact loaction.
By default, the location is “C: \Program files\putty\scp”.
You can open it from the Power Shell also.
PSCP Command syntax
The basic syntax of the pscp command is:
pscp [option] username@host source file: destination folder
option: These are optional parameters that change the behavior of the pscp command.
-P : It define the ports of remote server,
-i : It define the path for private key authentication.
-C : It compresses the data to speed up file transfer,
-r : It copies the files repeatedly.
(:) : Colon use to separate the local system and remote system.
source file: It is the file you want to copy.
username@host: Username is your name on the remote server and host is the hostname or IP address of the remote server.
destination folder: This is the location you want to save the file.
Private Key Authentication by PSCP
Private key authentication is widely used method to connect remote servers when using PSCP command. It involves the use of SSH keys (Private and Public keys). This increases the security and securing the file transfers.
PSCP use private key for authentication including a brief process:
Generate SSH keys
First, we have to generate SSH key pairs on local machine. The key pairs consist of private key and public keys.
Copy public key
To install the public key on the remote server, run the command
ssh-copy-id -i /path_to/public_key username@host
/path_to/public_key: It define the exact path of public key.
username: It is your name on the remote server.
host: is the hostname and IP address of the remote server.
After completing the installation, you will get the message that public key added to ‘authorized key’ files.
Use PSCP command
To identify the private key, run the command
pscp -i /path_to/private_key filename username@host/path_to/destination
/path_to/private_key: It is the exact path of the private key.
username: It is your name on the remote server.
host: It is the hostname or IP address of the remote server.
/path_to/destination: It is the location of the file you want to store on the remote server.
The scp command uses the private key for authentication when connecting to remote server. It provides a way to establish the connection without password.
By using the private key authentication with pscp command. you can securely transfer the file from your local machine to the remote server. Authentication can prevent unauthorized access.
PSCP command
PSCP is specially designed for secure file transfer between your local computer and remote server.
PSCP Command to Transfer File from Local system to Remote System
The basic syntax to copy is
pscp /path_to/filename username@host:/Path_to/destination folder
/path_to: It is the exact path of the file you want to copy.
filename: It is the name of the file you want to copy.
username: It is your name on the remote server.
host: It is the hostname or IP address of the remote server.
/path_to/destination_folder: It is the path where you want to copy the file on the remote system.
then press enter. The file is copied to remote server destination folder.
PSCP Command to Copy File from SSH Server to Local Computer
The basic syntax to copy remote file to local computer
pscp username@host:/path_to/filename destination_folder
username: It is the name of the remote server.
host: It is the IP address of the remote server.
/path_to: It is the exact path of the file you want to copy from the remote server.
filename: It is the name of the file you want to copy.
destination folder: It is the location in which you want to copy the file from remote server.
Then press enter, and you will be prompted to enter the username and password for authentication. The file is copied to your local computer.