M
M
Michael2018-04-11 10:15:08
Nginx
Michael, 2018-04-11 10:15:08

How to give SFTP access to site root folder on nginx in ubuntu?

Please tell me the solution to the problem.
The situation is that nginx keeps sites in the /var/www/html/example.com directory - for example
I need to configure sftp access to this folder from under netbeans in order to edit the code directly on the server. In sshd_config I wrote /var/www/html
in Chroot directory , but the connection breaks with the error " bad ownership or modes for chroot directory " Google on this issue suggested that the folder needs root rights, registered access to the root folder, but it did not help access via sftp to the root folder of the user is described everywhere, or with the substitution of the user's folder in / var / www, but I need to go directly to the root of the site.
Please tell me in an accessible language how to solve this issue, because I'm just starting to master nix.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
C
catanfa, 2018-04-19
@catanfa

try to give the user under which you are connecting, the rights to read and write to your site directory (you can simply make it the owner with the chown command). To check, go to the server via ssh under the desired user and try to read / write the site files. If you see an error in permissions, then the problem is in the rights. Don't forget about read permissions for all directories that are higher in the hierarchy than the site directory.
At the very least, you can just use root as a user in NetBeans, but this is obviously bad practice.

I
ioannes, 2018-07-12
@ioannes

Oddly enough, bad advice.
The chroot folder MUST NOT be writable by the user!
https://www.google.com/search?q=sshd+bad+ownership...
ChrootDirectory
Specifies the pathname of a directory to chroot(2) to after authentication. All components of the pathname must be root-owned directories that are not writable by any other user or group. After the chroot, sshd(8) changes the working directory to the user's home directory
ChrootDirectory - this folder must be owned by root and other users must not have write access.
Otherwise, we get an error:
fatal: bad ownership or modes for chroot directory

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question