## What is PSFTP?

PSFTP is the Secure File Transfer Protocol (SFTP) client of PuTTY – world’s most popular free SSH client. It one of the many components of PuTTY and is mainly leveraged for file transfer between computers using SSH connection.

It is a text-based client for secure file transfer protocol that will permit users to executive file transfer session.

PSFTP comes as part of the PuTTY suite when downloaded. Users can download PuTTY or independent components of PuTTY from here. Below are three ways to open PSFTP:

1. Click on the Windows Start button and go to ‘All Programs.’ From the list of program, Click on PuTTY and then PSFTP.
2. The second option is to enter the following path in the address bar –  “C:\Program Files (x86)\PuTTY” and then double-click on psftp.exe.
3. Another way to launch PSFTP from Windows command-line interpreter – Command Prompt. However, to open it from the command prompt, the application will have to ‘PATH’ or in the current directory. To add PSFTP to the ‘PATH’, users can type the following command

'set PATH=C:\path\to\putty\directory;%PATH%'

One of the advantages of using PSFTP is that it has a simple command-line syntax. Once the session is in operation, programmers can type commands to execute file transfer.

Users must take note that any command starting with ‘#’ is considered a comment and therefore is ignored.

## PSFTP Commands

PSFTP can execute most of the primary psftp command lines that are supported by PuTTY application. Users must ensure that they only apply commands that related to file transfer utility. One can type ‘help’ in the PSFTP prompt to display the list of commands supported by PuTTY’s SFTP client.

Opening and Terminating Session

Users that have opened PSFTP from command line must need to establish a link to the SFTP server.

To open a connection, type the following command “open host.name.” However, if a user wants to state a particular username as well, they have to write the following command “open user@host.name”.

Also, one can also define the port as well using this command “open user@host.name.”

Caution: If a user mistypes any information, then there are not able to reissue it as the PSFTP will terminate it immediately.

Once a session is complete, users can type close the connection by entering the command ‘quit.’ It will also terminate the PSFTP session and once again will restore to the command line. If one has started PSFTP from the graphical user interface, then the command will close the PSFTP console window.

Users can also enter ‘bye’ and ‘exit’ command instead of ‘quit’ as they all provide the same function.

If one wants to close the network connection type, then the user has to run the ‘close.’ In contrast, the command ‘open’ will initiate a  new connection.

### Other Common PSFTP Commands

Below are some of the basic PSFTP command:

• -l user  – The command will set the remote username to the user.
• -pw password – It will set the remote password to password. Note: Changing the password will display it to other users that use the local computer.
• -P port – It will connect to the port.
• -load session – The command will load settings from the saved session.
• -batch – It will disable interactive prompts.
• -hostkey key – All this command does is define the supportable host key. The command can be executed multiple time but users must note that it will override the automated host key management.
• -B – It specifies a file with batch commands. The ‘-b’ command helps user automate tasks by allowing them to set commands in advance.
• -BC – It displays batch commands in the same way they are run.  When the command is inputted, PSFTP will

Quoting Rules

PSFTP marks most of the commands as a sequence of words that are separated by spaces. However, at times, users have to define a filename that has spaces. For that matter, one can write it between double quotes. The double quote is functional for both local and remote files.

For example, the file name is my work.txt. As it contains space, programmers can specify the file name as follows:

psftp> get "spacey file name.txt" "save it under this name.txt"

The primary function of the double space is to ensure that the space between the filename it surrounds is not considered as word separators. More so, the PSFTP prompt will remove the double quotes itself and not view it as a file name.

Also, users can double the double quote in case the name has a double quote. Usually, it happens on Unix like system that allows double quote in file names.

For example, see the below command:

psftp> ren ""it"" "is a file with ""quotes"" in it"

## Public Key Authentication With PSFTP

Akin to PuTTY, there are three ways PSFTP can authenticate using a public key. The most common way is using PuTTY’s saved session instead of hostnames. Follow the below steps to do so:

Firstly, open PuTTY, and create a saved session that defines the systems crucial private file. More so, users should also specify a username that will help them login securely.

So now, users can employ saved sessions in place of usernames in PSFTP console. Type in the following command ‘PSFTP sessioname’. Note: One must write the name of the session in place of ‘sessioname.’

Another way PSFTP can authenticate is that by applying the name of a private key file with the -ioption command.

PSFTP can also authenticate leveraging SSH authentication agent Pageant. Firstly, users must ensure that Pageant is functional, and it has the private key stored. Next, it will automatically identify Pageant as soon one specifies user and hostname to PSFTP.

## Difference Between PSFTP and PSCP

PuTTY has several components that are leveraged to transfer files between computers. One such part is PSCP – the Secure copy protocol (SCP) client of PuTTY. It is an application to transfer data securely between hosts employing SSH connection. It is a command line tool; hence, one has to run the app from the console window.

While PSCP and PSFTP both allow users to transfer the file via the SSH connection, they do have their differences.

One of the significant distinction between the two is that PSFTP only employs SSH-2, which is the latest SFTP protocol. In contrast, PSCP leverages virtually every SSH server. Another significant difference is that PSFTP is an interactive client for the SFTP that allows users to interact with sessions such as Windows FTP program. As such, users can run multiple commands and even index contents of directories. Meanwhile, PSCP is programmed only to carry out single file transfer operation.

Above is a brief on PuTTY’s SFTP client. Users can find more information on PuTTY here.