HomeReviewsPscp in Linux System: Everything You Need To Know About

Pscp in Linux System: Everything You Need To Know About

There are tools for securely copying online files in Linux and web servers from one destination to another. A few tools can establish connections over a secure shell (SSH) on Linux. Putty is one of the most used, user-friendly, and efficient tools for establishing the SSH connection as an individual terminal emulator. This tool is free and open source, and you can use it as a terminal emulator; the Linux and Unix shell commands work perfectly on Putty. Here, the term pscp is defined as the Putty SCP.

If you’re already an experienced Linux user, you might already know that the cp command is used for copying files. And, the scp is used for secure copy. In one line, the PSCP command is an efficient and effective command-line-based secure copy for the Putty tool.

Pscp on Linux System


In Linux, you can also use the Pscp tool with Putty and Pssh (Parallel SSH Tools) for SSH and OpenSSH. Most server admins use the Pscp command to access the files over servers or clients and copy files. Unlike other GUI-based SSH tools, using the Pscp is preferable because this command allows the users to log in effortlessly, and the tool does not slow down the system.

The GUI-based tools also allow the users to copy and paste files through a Linux host server which is normally heavy to use. Applications like anydesk or TeamViewer are easy to use but not recommended while attempting to execute the operations on a Linux server or host. In this post, we will see how to use the Pscp command on a Linux system.

1. Know The Syntax and Flag Details of Pscp


Here are the basic syntaxes of how the pscp command function in a shell command. The below commands show how we usually use the pscp command.

pscp [options] [user@]host:source target
pscp [options] source [source...] [user@]host:target
pscp [options] -ls [user@]host:filespec

In a basic pscp command, we can see the below-mentioned syntaxes and flags. Here is a brief idea of what these flags and syntaxes do to the pscp command.

  • V: The v flag display the version of Pscp
  • pgpfp: The pgpfp syntax can print the public and private key pair or the fingerprints of the Putty
  • ls: It shows the list of directory
  • p: This p flag is used for attributes
  • q: Use the Q flag to quit the task
  • r: Use this flag to copy folders repetitively
  • v: This one prints the descriptive details
  • load session: Loads the ongoing sessions on Putty
  • P port: Used for assigning network ports
  • l user: List the current users on Putty
  • pw password: Set the password for users over Putty
  • i path: For entering the private key for authentications

2. Some Facts About Pscp


While using the Putty SCP command, you might need to know some basic rules of the Putty scp to make your experience smooth. Here, I am enlisting some facts about pscp on Linux.

i) Know The User and Host in Pscp


In a pscp connection, while you access the server or another machine from your system over an SSH connection, you’re the user, and the other end is the host. Your login name will be displayed as the ‘user_name’.

ii) PSCP on Existing Putty


If you’re an existing Putty user on the same system, you can also use the Putty host and user details. In some cases, the existing Putty user name and sessions are used on the remote server. You can also use a pscp public key over the ssh connection instead of a login credential for SSH.

iii) Copy Directories


By default, when you log in to the remote server, the pscp does not automatically copy the file; you will need to specify which directory you want to copy manually. You can use the -r flag on the pscp command to recursively copy files.

3. SCP vs. Putty SCP


Summing up the notion, pscp, or Putty secure copy client, is a tool for transferring files through a secure shell between servers or computers over an SSH protocol. The main difference between the scp and pscp is that while using the PSCP, you will need to establish the connections via Putty. But, in Scp connections, you can use the SSH connections without the Putty tool. Please note that you can also run SCP on Putty.

Here, I am including two examples of scp and pscp commands to understand better. Both of the commands are used for copying files over a secure shell.

SCP Command :

scp [options] [<user>@]<host/IP>:<source> <target>
scp -r script-1/ [email protected]:/ubuntupit/script-1

You can now see the command for pscp to copy files. Both of the commands are pretty much the same.

PSCP Command :

pscp -r script-1/ [email protected]:/ubuntupit/script-1

4. Install Putty on Linux


In some cases, you might need to install the Putty tool to run pscp commands on Linux. The full form of the Putty tool is Popular SSH and Telnet Client. Installing the Putty on a Linux machine is easy and hassle-free. Here, I am giving the CLI methods to install Putty on Linux. Please execute the below-provided commands according to your distribution.

i) Putty on Debian/Ubuntu


Please execute the below-mentioned commands on Ubuntu/Debian Linux to install Putty.

sudo add-apt-repository universe
sudo apt update
sudo apt install putty

install putty pscp on linux

ii) Install Putty on Arch Linux


To install the Putty tool on Arch and Manjaro, you will need to open the Pacman configuration script. Then you’ll need to remove the # symbool from the script and save it. Here, we uncomment the scripts that we will need to execute Putty.

You can use the below nano command to edit the Pacman configuration script.

sudo nano -w /etc/pacman.conf

You may now run the below-mentioned Pacman commands to install Putty.

sudo pacman -Syy
sudo pacman -S putty

iii) Putty on Fedora and SuSE


To run pscp commands on Fedora, you can use Putty. The below-mentioned dnf command will let you install Putty on the Fedora workstation.

sudo dnf install putty

Similarly, the below-mentioned zypper command would allow you to install Putty on SuSE Linux.

sudo zypper install putty

After a successful installation, you may now run the below command to configure Putty on Linux.

putty ssh configuration

$ putty -v

5. Use Pscp to Copy Multiple Files


Here, we will see how to copy multiple files on a Linux server over SSH via pscp. First, we will need to assign the ip address with the SSH port on the file that we want to copy. Let’s say we are creating a file named New_pscp_hosts.txt, and the below-mentioned ip addresses are added to the host file.

192.168.0.101:22
192.168.0.102:22

i) Copy Files to Multiple Linux Servers


To copy multiple files to a Linux server, you can use the below-mentioned pscp command.

# pscp -h New_pscp_hosts.txt -l ubuntupit -Av wine-1.7.55.tar.bz2 /tmp/

Example Output

Warning: do not enter your password if anyone else has a superuser
privileges or access to your account.
Password:
[1] 17:48:25 [SUCCESS] 192.168.0.101:22
[2] 17:48:35 [SUCCESS] 192.168.0.102:22

Here is the explanation of all the switches or flags used on the command.

  • -h: the h is added to read from the host file.
  • -l: The I specifies the host username and ensures that it does not add another user.
  • -A: Ths one is used to add a password over the SSH
  • -v: The v switch can execute pscp in a verbose mode

ii) Copy Directories to Multiple Linux Servers


Just like the above command, if you need to copy multiple directories over SSH, you can use the below-mentioned command.

# pscp.pssh -h New_pscp_hosts.txt -l ubuntupit -Av -r Android\ Games/ /tmp/

Sample Output

Warning: do not enter your password if anyone else has a superuser
privileges or access to your account.
Password:
[1] 17:48:25 [SUCCESS] 192.168.0.101:22
[2] 17:48:35 [SUCCESS] 192.168.0.102:22

6. Fix Pscp Issues on Linux


If you’re a newbie on pscp or Putty, you might face some issues. Here, I am enlisting a few issues that most people face and how you can solve them on your Linux machine.

i) Pscp Error: Cannot Open File


If you’re facing an issue while opening a file via the Putty scp, please make sure that your file is connected with the database, your database port is added to your system, and a firewall is also allowed. In addition, also you might need to check if any other tools are not preventing the Putty SCP operations on the system background.

ii) Error: Permission Denied


While using pscp, please make sure you log into the host server as a root user if you’re getting the permission denied message. Also, you might need to use the chmod command on the specific folder or directory before you run the Putty SCP command. In most cases, Linux denies permission for /var/www/ directory over pscp.

iii) Putty Runs But Not Putty SCP


If your Putty tool is running smoothly on the system, but you can not run the pscp command on the shell, you probably need to update the Putty tool on your system.

Insights!


In the entire post, we have gone through the notion of Putty scp, the difference between the scp and pscp. We have also seen the methods of installing Putty on Linux. Later, we went through a few commands to copy files over pscp and briefly explained how you can solve some of the major issues.

I hope this post has been helpful for you; if yes, please share this post with your friends and the Linux community. You can also let us know your opinions about this post in the comment section.

Mehedi Hasan
Mehedi Hasan
Mehedi Hasan is a passionate enthusiast for technology. He admires all things tech and loves to help others understand the fundamentals of Linux, servers, networking, and computer security in an understandable way without overwhelming beginners. His articles are carefully crafted with this goal in mind - making complex topics more accessible.

LEAVE A REPLY

Please enter your comment!
Please enter your name here


You May Like It!

Trending Now