All actions will also be relevant for CentOS/RHEL systems. In this example, a user will be added for access via SFTP using an SSH key to the web directory under Apache management. There is a default for Apache group “apache“, if necessary, replace the desired one.

All sites are on the dir:

Add the user sftpuser (already in the existing group):

Let’s give the group rights to write, since we will change the owner:

Change the ownership of files:

The “html” directory itself should not belong to the “sftpuser” user

Create a directory for public keys and give it the necessary rights:

In this directory, create two files and place the public SSH key in them:

Set the necessary rights to the file:

Making the user sftpuser owner:

Open the SSH server configuration file:

Replace the string:

On the following:

And add the following block to the end of the file:

Reboot the SSH service:

We connect via SFTP client by specifying the username “sftpuser” and the path to the private SSH key, on the basis of which the public one was generated, the port for connection is SSH port (by default 22).

Speak with an expert on our team to discuss Cloud solutions tailored to your business.

You’ll receive free recommendations tailored to your business.

Pin It on Pinterest