Py学习  »  docker

docker nginx worker进程以非根用户身份运行,但仍然可以访问根用户拥有的文件

SkyRar • 5 年前 • 1827 次点击  

我在用docker nginx官方图片 https://github.com/nginxinc/docker-nginx/blob/master/stable/alpine/Dockerfile . 我跑得像 docker exec -it -v drupal:/var/www/drupal/web

网状物 是我的文档根目录。当我进入 /var/www/drupal/web ls -al 我看到文件权限如下。所有东西都归root所有,而 nginx工作进程 属于 恩吉克斯 非根用户。但当转到localhost:80时,我可以访问我的网站。这怎么可能?nginx用户如何访问根用户拥有的文件?有安全问题吗?

-rw-r--r--    1 root     root          1025 Oct 18 23:39 .csslintrc
-rw-r--r--    1 root     root           357 Oct 18 23:39 .editorconfig
-rw-r--r--    1 root     root           151 Oct 18 23:39 .eslintignore
-rw-r--r--    1 root     root            41 Oct 18 23:39 .eslintrc.json
-rw-r--r--    1 root     root          3858 Oct 18 23:39 .gitattributes
-rw-r--r--    1 root     root          2314 Oct 18 23:39 .ht.router.php
-rw-r--r--    1 root     root          7866 Oct 18 23:39 .htaccess
-rw-rw-rw-    1 root     root           385 Oct 18 23:39 autoload.php
drwxr-xr-x   44 root     root          1408 Oct 18 23:38 core
-rw-r--r--    1 root     root           549 Oct 18 23:39 index.php
drwxr-xr-x    3 root     root            96 Oct 18 23:39 modules
drwxr-xr-x    3 root     root            96 Oct 18 23:39 profiles
-rw-r--r--    1 root     root          1594 Oct 18 23:39 robots.txt
drwxr-xr-x    6 root     root           192 Oct 18 23:39 sites
drwxr-xr-x    3 root     root            96 Oct 18 23:39 themes
-rw-r--r--    1 root     root           848 Oct 18 23:39 update.php
-rw-r--r--    1 root     root          4555 Oct 18 23:39 web.config

nginx容器过程如下:

17     1 nginx    S    14344   1%   0   0% nginx: worker process
 1     0 root     S    13896   1%   0   0% nginx: master process
Python社区是高质量的Python/Django开发社区
本文地址:http://www.python88.com/topic/39956
 
1827 次点击  
文章 [ 1 ]  |  最新文章 5 年前
David Maze
Reply   •   1 楼
David Maze    6 年前

ls -l 上市 r 在第八列中,表示文件是世界可读的;目录 x 在第十列中,任何人都可以访问。从你发布的内容来看,没有什么是访问任何它无权访问的内容。

(世界可写 autoload.php 如果它允许对系统具有shell访问权限的任何人编写web服务器将运行的任意代码,则可能是危险的。)