Transferring Files (SFTP)
There are various methods of transferring files between networked devices. This section covers the use of the Secure File Transfer Protocol (SFTP), which is also referred to as SSH File Transfer Protocol.
SFTP is protocol independent and can be encapsulated in protocols other than SSH. As a consequence SFTP does not provide security or authentication methods - it relies on the underlying protocol for security. When transferring files using SFTP over SSH all data will be encrypted, ensuring a secure method of transferring data over the internet.
There are numerous SFTP Clients available. Many of these clients rely on command line interfaces, however some are GUI based. The following SFTP Client software is covered in this guide -
The following information is required when connecting to the server -
- Account name on SSH Server (e.g. User)
- Private keyfile used to authenticate login to the SSH Server (e.g. C:\keyfile.ppk)
- IP Address (or Dynamic DNS host/domain name) of SSH Server (e.g. 192.168.2.2)
The following information has been taken from the WinSCP website.
"WinSCP is an open source free SFTP client and FTP client for Windows. Legacy SCP protocol is also supported. Its main function is safe copying of files between a local and a remote computer."
This section is not intended to be a WinSCP tutorial, it merely details the steps needed to connect to the Server. For WinSCP documentation see here.
Start WinSCP.exe to open the Login box -
Ensure the Session options are selected and enter the following settings, then click on the Login button -
- Host name: - 192.168.2.2 (IP Address of Server)
- Port number: - 22 (port on server configured for SSH connections)
- User name: - User (user account on Server)
- Private key file - C:\keyfile.ppk (Private keyfile with path)
- File protocol - SFTP
If the Server if found you will be prompted to enter a Passphrase to authenticate connection. Enter your passphrase then click on the OK button -
The screenshot below shows the WinSCP GUI in Explorer interface mode (interface mode can be set in the WinSCP Login menu by enabling Advanced options and selecting Preferences - see here) -
To browse available drives on the server type /cygdrive in the address bar (or browse to the (root)/cygdrive/ folder if CopSSH is installed on the Server) -
To connect to a Share on the Server enter the share name in the address bar (including the computer name) in the format //servername/sharename.
To transfer files use drag and drop or change the interface mode to Commander (see here).
To terminate the connection just close the WinSCP window. You may see the following warning, just click on OK -
The following information has been taken from the PSFTP website.
"PSFTP, the PuTTY SFTP client, is a tool for transferring files securely between computers using an SSH connection....PSFTP allows you to run an interactive file transfer session, much like the Windows ftp program. You can list the contents of directories, browse around the file system, issue multiple get and put commands, and eventually log out. By contrast, PSCP is designed to do a single file transfer operation and immediately terminate....etc."
This section is not intended to be a PSFTP tutorial, it merely details the steps needed to connect to the Server. For PSFTP documentation see here.
PSFTP is a command-line application. To connect to the server use the following command syntax -
psftp.exe -l username -P 22 -i keyfile IP_Address [enter]
- -l username - connect to server account username
- -P 22 - connect to port 22 on the server
- -i keyfile - use private keyfile keyfile (with path)
- IP_Address - IP Address of the server.
Using the settings for our own server -
psftp.exe -l User -P 22 -i C:\keyfile.ppk 192.168.2.2
Enter the Passphrase for the Private keyfile used to authenticate connection to the SSH Server when prompted.
To connect to a Share on the Server use the cd (change directory) command followed by the share name in the format //servername/sharename - e.g. to connect to share stuff on server user-PC1 use command cd //user-PC1/stuff.
To connect to a drive on the Server use the cd (change directory) command and cygdrive. Use command cd /cygdrive/# to change the working directory to drive #: