It is impossible to imagine working with a remote server without a secure file transfer system between the system and the user - and it is hard to do something without SFTP. In order for the protocol to work correctly, it is critically important to properly configure SFTP with different versions of both Linux and Windows. In this article, we'll show you how to do it quickly and easily!
SSH File Transfer Protocol - this is how the abbreviation SFTP stands. The full name clearly shows the main feature of the protocol: it is built on the Secure Shell technology. This ensures that the transmission of all information is encrypted, from files to usernames and passwords. Even in FTPS (FTP with SSL), not to mention regular FTP, there are more restrictions. By the way, if you go into details, SFTP is not related to FTP at all - they have different technological bases.
In addition to being highly secure, SSH File Transfer Protocol has other advantages:
Separately, it is necessary to stipulate: the SFTP protocol is used on UNIX systems, and often the standard utilities already have both a client and an SSH server.
Installing and configuring SSH File Transfer Protocol is not too difficult, but the story should be divided into two directions - depending on the OS used.
First of all, you should install the SSH package on the server side of OpenSSH and on the user side. The first task is solved by the following commands:
And to organize access from a computer, you need a command of the following form:
After that, you can go directly to the SFTP configuration. All work should be divided into several stages:
1.Creation of groups and users. By creating users and dividing them into groups, you can fine-tune their rights, capabilities and restrictions on access to a particular directory on the server. To do this, you need to do:
2. Creation of directories. If the server has a root directory (let's call it ‘catalog’ for example), each user can only have access to a certain "own folder" - it is where he gets when logging in. In this case, you can configure SFTP so that the user can see the contents of the folder, but the file is uploaded to a separate section (for example, ‘loadfolder’). You will need the following commands:
sudo mkdir -p / catalog / USERNAME/loadfolder
sudo chown -R root.GROUPNAME/catalog/USERNAME
sudo chown -R USERNAME.GROUPNAME/catalog/USERNAME/loadfolder
3. Setting up sshd_config. This is necessary for two purposes. On the one hand, the user will have SFTP open (and not the usual SSH shell). On the other hand, he will not be able to go up a level in the directory and see sections for other users. To do this, add the following code in the / etc / ssh / sshd_config file:
Match Group GROUPNAME
4. Reboot. To make the whole system work, it remains to restart it:
That's it - Linux SFTP setup is complete! Login is similar to the same command under SSH. Use the special syntax to manage the content of the server:
COMMAND [SOURCE] [DESTINATION]
Here are some of the most used examples:
Initially, Microsoft's desktop and server operating systems did not support SFTP, so third-party tools were required to work with it. But today there is already an official package for such tasks - Win32-OpenSSH. Startup and configuration depend on which version of the operating system is installed.
1. Windows Server 2019 or Windows 10 1803+
These OS options from Microsoft offer the simplest scenario for starting an SFTP server because Win32-OpenSSH is already a part of them. There are two ways to install:
It remains to find out the addresses at which all the most important will be located:
2. Windows Server 2016/2012 R2
In this OS, as in the early Windows 10 versions, to configure SFTP, you need to download OpenSSH - look for the version for a 64-bit system on GitHub. After unpacking the archive into the desired directory (for example, C:\catalog_OpenSSH), you need to perform a number of procedures:
After configuring SFTP in Windows, all that remains is to make a number of changes to the configuration file. Here are some standard examples:
After all the adjustments, launch an SFTP client (for example, WinSCP), enter the server type and name, credentials in it - and log in (the first time you connect, you should see a message that the host key is not in the cache). If the familiar file manager interface with the user directory on the server opens, then everything is configured correctly!
Practice shows: although setting up SFTP is quite simple, in many cases users have various questions and non-standard situations. To understand them, competent help is something worth considering - in the form of professional technical support from the provider. We at HostZealot pay maximum attention to it. Whether you order a VPS for Windows or Linux, you can rely on the advice of our specialists - they will help not only with debugging the SSH File Transfer Protocol but also with any other tasks in setting up your server!