D
D
Desch2015-07-12 12:33:47
JavaScript
Desch, 2015-07-12 12:33:47

How to restrict a user in his home folder?

For the N-th number of years, a familiar scheme on the web server was formed, which left open security issues, and now, when you have to let third-party users in, they have become critical.
NGINX + PHP5-FPM bundle, users are based in /var/www/USER/SITE .
The owner of /var/www/USER is root . Total inside - USER . All users hang on different PHP-FPM pools. Access exclusively via SFTP, users are locked in their own folder via setting in sshd_config:

Subsystem sftp internal-sftp

Match group www-data
        ChrootDirectory %h
        X11Forwarding no
        AllowTcpForwarding no
        ForceCommand internal-sftp

Pool example in PHP-FPM:
[USER]
user = USER
group = www-data
listen = 127.0.0.1:PORT
chdir = /var/www/USER/

1) If you fill in r57shell, then nothing prevents you from rising above your level and looking anywhere. How to fix it?
2) Some of the sites use an impromptu PHP library located in /var/www/libs , making it Include in scripts - what is the right way to organize a "shared library"? (I guess that with the right restriction of users, above /var/www/USER they will not be able to include anything).
PS The options found on the net with any kind of shamanism and editing basedir led to File not found when *.php was executed

Answer the question

In order to leave comments, you need to log in

3 answer(s)
A
Anton Neverov, 2018-11-14
@IT-Programmer

Because you don't have the $(this) variable inside the test function.
Your solution will be:

function test(item){
    alert(item.attr('class'));
}

A
Andrey Burov, 2015-07-12
@Desch

; Chroot to this directory at the start. This value must be defined as an
; absolute path. When this value is not set, chroot is not used.
; Note: you can prefix with '$prefix' to chroot to the pool prefix or one
; of its subdirectories. If the pool prefix is not set, the global prefix
; will be used instead.
; Note: chrooting is a great security feature and should be used whenever 
;       possible. However, all PHP paths will be relative to the chroot
;       (error_log, sessions.save_path, ...).
; Default Value: not set
;chroot =

and /var/www/lib needs to be put for each user.

D
DENIS SHELESTOV, 2015-07-12
@djdeniro

open console
chmod 666 -R /YOU/DIR/HERE

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question