Introduction to WinSCP
WinSCP is an open-source, free sftp and ftp client for Windows. Its main function is safe copying and transfer of files between local and remote computers.
In this article we’ll talk about how to securely transfer files between your Windows machine and your server using the WinSCP application. We’ll also cover creating new files and setting their permissions.
Download and install
First, WinSCP should be downloaded from this website. After you download the installation file double-click it to install.
What’s the difference between a typical and custom installation?
Custom installation gives you the option to select the file’s destination, the components to be installed, and the features within the WinSCP application, such as:
- Drag & drop shell extension (allows direct downloads, may require restart)
- Pageant (SSH authentication agent)
- PuTTYgen (key generator)
Next you’ll be asked which interface style you prefer.
The Commander interface displays two panes. Your local files are on the left and remote files are on the right. The Explorer style displays only remote files in a single window.
It’s generally easiest to start with the Commander style. You can change your default choice later from “Preferences” in WinSCP.
The default port for SFTP is 22 and is already set in the window. We recommend configuring sshd (the ssh/sftp server) to listen to a different port from the default, so for this example we’ll use port 30000:
SFTP port: 30000 Username: demo Ip address: 220.127.116.11
For the Host Name enter the IP address of your server and change the Port to match your sshd port.
Ensure the Connection Type is set to sftp. You can save this configuration by clicking the save button next to the login button. Give it a name you’ll remember – we used “demoserver” here. Configurations can be found under Stored Sessions. A different name can be chosen for each of your servers.
A private key can be used for login to a slice.
If this is the first time you have used WinSCP to sftp into your server you’ll see a warning similar to this:
If you’re sure you’ve entered the correct details (IP address, etc.), click “yes”. Subsequent connections to this server should not show this warning.
Once you’re connected you should see the file browser.
Here Commander has been chosen as the user interface. The local machine is shown in the left pane and the server file system in the right pane of the window. You can transfer files to and from your server by dragging and dropping the files and directories you want to copy.
If you don’t have permission for an operation you are attempting you’ll receive a message saying “permission denied”. That usually means you’re trying to upload a file to a directory where you don’t have write permission.
The little lock on the lower right side of the window shows that the connection is secure. If you double-click that icon you will see some security features of your connection like the encryption algorithm being used by sftp. When you use WinSCP to connect an ftp server you won’t see that little lock, since ftp doesn’t provide secure (encrypted) communication.
Creating files and directories, and setting permissions
To create a new file or directory on your server click on the File menu, go to “New”, and then select the item you want to create. A window will pop up asking you to name your creation.
When you make a new file WinSCP launches an internal text editor similar to Notepad.
WinSCP starts an upload when you save the remote file. You can also designate a different editor in the Preferences if you want to use a more complex text editor.
When you create a new directory on your server you will see a dialog box like the following:
You can check the “Set permissions” box and change the permissions for the new directory by selecting R, W and X (for read, write, and execute) for each accessor type. You can also see the equivalent octal value for your settings. The new directory will be owned by the user you used to login via sftp.
You can change permissions for an existing file or directory by right-clicking it and then selecting “Properties” from the menu.
WinSCP is a very capable sftp client for Windows users. Files can be securely copied between your Windows machine and your server since all of the communication is encrypted. It also allows flexibility when creating and modifying files or changing file permissions.