In this article you will learn how to securely transfer files between your windows machine and your slice, using the WinSCP application. You will also learn how to create new files and set their permissions.
WinSCP is an open-source free SFTP client and FTP client for Windows. Its main function is safe copying and transfer of files between a local and remote computer. Windows Vista SP1 was used for this article. Different versions of Windows may have slightly different screens.
Download and install
First, WinSCP should be downloaded from this website. After you download the installation file, double click the executable file of WinSCP.
Select your preferred user interface here. You can change your preference later from “Preferences” in WinSCP.
What’s the difference between typical and custom installation?
Custom installation gives you the option to select the file’s destination, components to be installed, and the features within the WinSCP application.
- Drag & drop shell extension (allows direct downloads, may require restart)
- Pageant (SSH authentication agent)
- PuTTYgen (key generator)
The default port for SFTP is 22 and is already set in the window. However, for this example I'm going to use the following configuration, as per the setup articles:
- SFTP port: 30000
- Username: demo
- Ip address: 18.104.22.168
In the Host Name enter the IP address of your Slice and change the Port to 30000 (if you have not already configured your slice, leave this at the default of 22).
Ensure the Connection Type is set to SFTP. You can save this configuration by clicking the save button next to the login button. I have saved my configuration as mySlice1. It simply saves time next time you use SFTP. Configurations can be found under Stored Sessions. A different name can be chosen for each Slice.
A private key can be used for login to a slice. (For how to set up public/private keys, check this article.)
If this is the first time you have used WinSCP to sftp into your VPS, a warning similar to the one below will be shown:
Providing you are sure you have entered the correct details (IP address, etc) then click 'yes'. Subsequent connections will not show this warning
Here Norton Commander has been chosen as the user interface. The local machine is shown at the left side and the slice at the right side of the same windows. You can upload/download files from your slice by dragging and dropping files/directory you want to upload or download. If you do not have permission for an operation you are attempting, you will receive a message saying "permission denied".(i.e trying to upload a file to a directory to which you don’t have write permission)
You see little lock on lower right side which shows that the connection is a secure connection. If you double click the icon you will see some security feature of your connection such as the algorithm you are using, the sftp protocol you are using, etc. (When you use WinSCP to connect an ftp server you cannot see that little lock, since ftp doesn’t provide secure communication.)
Creating file and directory, and setting permissions
To create new directory or file on your slice, simply right click and then select either directory or file. A window will pop-up requesting a name for the new file you are creating.
WinSCP comes up with internal text editor that has same capability as notepad.
WinSCP starts an upload when you save the remote file. You can also setup different editor from preference menu if you want to have complex text editor. When you create new directory on your slice you will see something below:
As you see you can check set permission box and set the permission for that directory by simply clicking R, W and X. You can also see the equivalent octal value for your settings. Please remember that we login as “sliceIsmail” so owner of the directory will be that user. You can change permission of an existing file or directory by right clicking and then selecting “properties” from the menu.
WinSCP is a great sftp client for windows users. Files can be copied/pasted between your windows machine and your slice securely since all of the communication is encrypted. It also allows flexibility for creating, modifying files, and changing file permissions. I will explain other features of WinSCP such as executing commands on the slice, how to automate file transfers, synchronization, etc., in the next article.