V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX  ›  programV2  ›  全部回复第 63 页 / 共 77 页
回复总数  1526
1 ... 59  60  61  62  63  64  65  66  67  68 ... 77  
2020-02-11 21:21:43 +08:00
回复了 programV2 创建的主题 程序员 docker 容器挂载 volume 的目录权限问题
@anguiao 谢谢 ! 请问 1.我现在在主机新建普通用户 foo: useradd -m -s -u 2005 -g 2005 foo , 我建了 3 个 docker 容器:Nginx,Drupal, MySQL, 其中 Nginx 和 Drupal 容器都是挂载到 ./project/web , 这样我是不是需要同时改这两个容器的 uid gid? 分别进这两个容器执行下列命令吗?

usermod -u 2005 www-data
groupmod -g 2005 www-data
find / -user 82 -exec chown -h www-data {} \;
find / -group 82 -exec chgrp -h www-data {} \;

ps: 我刚进 nginx 容器发现没有 www-data 这个用户名,请问 nginx 服务访问 /project/web 用的是哪个用户名?

2. 改完 uid gid 后我在主机上执行 chmod -R 755 ./project/web 及 chown -R foo:foo ./project/web
为了减少网站被黑掉或挂马的危险, 还有什么地方该加固的吗? 我主机已经改成证书登陆了. 谢谢 V 友指点!
2020-02-11 17:30:43 +08:00
回复了 programV2 创建的主题 程序员 docker 容器挂载 volume 的目录权限问题
@litanid
@saytesnake 我 docker-compose.yml 部分设置如下
version: "3"
services:
nginx:
image: nginx:$NGINX_TAG
container_name: "${PROJECT_NAME}_nginx"
ports:
- $NGINX_PORTA

volumes:
- "./drupal/web:/var/www/html"
- "./drupal/logs/nginx:/var/log/nginx"
- "./drupal/nginx/nginx.conf:/etc/nginx/conf.d/default.conf"
- "./drupal/cloudflare:/etc/ssl"
depends_on:
- php

drupal:
image: drupal:$DRUPAL_TAG
container_name: "${PROJECT_NAME}_drupal"
volumes:
- "./drupal/web:/var/www/html"
- "./drupal/mysql:/var/lib/mysql"
restart: always
depends_on:
- mysql
2020-02-11 17:17:57 +08:00
回复了 programV2 创建的主题 程序员 docker 容器挂载 volume 的目录权限问题
@saytesnake 谢谢V友指点! 我建了 3 个 docker 容器:Nginx,Drupal, MySQL, 其中 Nginx 和 Drupal 容器都是挂载到 ./project/web , 直接 chown -R 82.82 /project/web 那我 nginx 容器不就无法访问这个数据卷了吗 ? 刚进 nginx 容器发现没有 www-data 这个用户名,请问 nginx 服务访问 /project/web 用的是哪个用户名?


@litanid V 友,我刚进 nginx 容器发现没有 www-data 这个用户名,请问 nginx 服务访问 /project/web 用的是哪个用户名?
2020-02-11 17:02:09 +08:00
回复了 programV2 创建的主题 程序员 docker 容器挂载 volume 的目录权限问题
@litanid 谢谢 V 友指点! 请问 1.我现在在主机新建普通用户 foo: useradd -m -s -u 2005 -g 2005 foo , 我建了 3 个 docker 容器:Nginx,Drupal, MySQL, 其中 Nginx 和 Drupal 容器都是挂载到 ./project/web , 这样我是不是需要同时改这两个容器的 uid gid? 分别进这两个容器执行下列命令吗?

usermod -u 2005 www-data
groupmod -g 2005 www-data
find / -user 82 -exec chown -h www-data {} \;
find / -group 82 -exec chgrp -h www-data {} \;

2. 改完 uid gid 后我在主机上执行 chmod -R 755 ./project/web 及 chown -R foo:foo ./project/web
为了减少网站被黑掉或挂马的危险, 还有什么地方该加固的吗? 我主机已经改成证书登陆了. 谢谢 V 友指点!
2020-02-10 23:02:56 +08:00
回复了 programV2 创建的主题 程序员 docker 容器挂载 volume 的目录权限问题
@litanid 谢谢 V 友回复!我刚查了下容器外的 www-data 是
uid=33(www-data) gid=33(www-data) groups=33(www-data)

而容器内 www-data 是
uid=82(www-data) gid=82(www-data) groups=82(www-data),82(www-data)

我只要改 uid 和 gid 就可以了吗? 后面的 groups=82(www-data),82(www-data) 不用管他吗?

另外想请问我容器外主机上部署容器是用 root 用户, 容器内运行用户默认也是 root, 这样有什么安全风险? 除了把挂载主机目录./project/web 的 owner 改成 www-data 及 chmod -R 755 ./project/web 外该如何加固?        

@saytesnake
2020-02-10 20:14:31 +08:00
回复了 programV2 创建的主题 程序员 docker 容器挂载 volume 的目录权限问题
@jinliming2 不行, 我试过安装网站时报错提示没权限

@litanid@anguiao 谢谢! 那我直接 id命令查看www-data的 UID 和 GID , 如果不一样, 再用 usermod groupmod 把主机上的用户 改成跟容器里的一样, 就行了吧? 改里面或者外面 的 uid 应该没区别吧?
2020-02-10 16:29:41 +08:00
回复了 programV2 创建的主题 程序员 docker 容器挂载 volume 的目录权限问题
@phy25 谢谢回复! 我用的容器是 drupal:8.5.5-fpm-alpine, drupal8 在 ubuntu 上搭建的话用户权限 owner 要设置为 www-data, 装进容器后是不是也是 www-data?
@momocraft 谢谢. 我主要的困惑是 drupal8 在 ubuntu 上搭建的话用户权限 owner 要设置为 www-data, 装进容器后是不也是 www-data?
2020-02-09 17:19:29 +08:00
回复了 whileFalse 创建的主题 问与答 有多少同学买了 2c8g5m 安装 windows 当云电脑用的?
@falcon05 说起向日葵,之前用过他们家有那个远程控制的软件。现在开始收费了吗? https://sunlogin.oray.com/enterprise/remote
2020-02-09 15:16:44 +08:00
回复了 whileFalse 创建的主题 问与答 有多少同学买了 2c8g5m 安装 windows 当云电脑用的?
@aabbcc112233 谢谢 那请问你们是直接用路由器开端口映射吗? 也就是说你出门在外的时候要打开智能插座 App (通过智能插座厂商的服务器)进行开启电源?
我这样理解对吗?
@falcon05 谢谢。frp 是实现端口转发,你 frp 服务端是部署在哪个设备上?也就是说你出门在外的时候要打开智能插座 App (通过智能插座厂商的服务器)进行开启电源?
我这样理解对吗?
2020-02-09 14:45:40 +08:00
回复了 whileFalse 创建的主题 问与答 有多少同学买了 2c8g5m 安装 windows 当云电脑用的?
@aabbcc112233 各位 V 友好,我的家宽有公网 IP。请问 FRP 你是部署在路由器上吗?谢谢。🙏远程唤醒的话需要电脑主板跟网卡支持远程唤醒功能吧?
@falcon05
@aloyuu
2020-02-08 13:04:20 +08:00
回复了 zhuwd 创建的主题 问与答 苹果手机有办法同时接收两个微信的信息吗
@soinman 这个随便一个微信号都可以登录微信企业版吗?还有什么门槛?
2020-02-08 00:52:32 +08:00
回复了 programV2 创建的主题 程序员 Drupal 迁移到 Docker,求问如何在 Docker 容器里安装 drush?谢谢
@hefish 谢谢大佬回复! 我跑了 3 个容器,一个容器跑 Mysql,一个容器跑 php 另外一个 nginx, 在 php 的环境里再跑 drupal,我在 docker-compose.yml 中的 php 和 mysql 都设置了 volumes: -."/drupal/mysql:/var/lib/mysql" , 这样理论两个容器之间就可以互相访问了, 又在 php 容器上手动安装了 drush, 然后现在登陆进 php 容器执行 ./drush --uri=http://serebiomedical.com pm-uninstall -y captcha 报错如下, 这个有可能是什么原因呢?
因为 drush 命令涉及到要访问 mysql 容器, 是还要再加什么参数吗?
另外大佬您方便的话可不可以帮我看看上面#10 楼我贴出的报错日志. 万分感谢! 

Command pm-uninstall needs a higher bootstrap level to run - you will need [error]
to invoke drush from a more functional Drupal environment to run this
command.
The drush command 'pm-uninstall captcha' could not be executed. [error]
Drush was not able to start (bootstrap) the Drupal database. [error]
Hint: This may occur when Drush is trying to:
* bootstrap a site that has not been installed or does not have a
configured database. In this case you can select another site with a
working database setup by specifying the URI to use with the --uri
parameter on the command line. See `drush topic docs-aliases` for details.
* connect the database through a socket. The socket file may be wrong or
the php-cli may have no access to it in a jailed shell. See
http://drupal.org/node/1428638 for details.
* connect to the database through a cli command using the
--defaults-extra-file parameter to pass credentials through a tmp file.
This method can break if other credentials are specified in a ~/.my.cnf
file in your home directory. You may have to delete or rename the
~/.my.cnf file in your home directory.
2020-02-07 23:39:22 +08:00
回复了 programV2 创建的主题 程序员 求助各位大佬们 登陆 drupal8 后台,点击任意菜单都出错
@programV2 我把 recaptcha 和 captcha 两文件夹重新都拷贝回去了还是一样的报错日志
2020-02-07 23:38:17 +08:00
回复了 programV2 创建的主题 程序员 求助各位大佬们 登陆 drupal8 后台,点击任意菜单都出错
@dearroy 谢谢回复! 我把 captcha 和 recaptcha 插件代码都拷贝回去了, 重启服务器还是提示一样的错误日志, 这个太坑了, google 了一晚上发现 5 年前有人遇到一样的, 按照里面的所有方法试了一遍都不行,
https://drupal.stackexchange.com/questions/147494/how-can-i-disable-a-troublesome-module
2020-02-07 21:26:48 +08:00
回复了 programV2 创建的主题 程序员 Drupal 迁移到 Docker,求问如何在 Docker 容器里安装 drush?谢谢
@TangMonk 确实很多坑,这是很早之前用 drupal 建的, 大佬, 我通过删掉 recaptcha 和 captcha 两文件夹并进入数据库清缓存来停用 recaptcha 和 captcha 模块, 登陆没有出现验证码终于进入管理后台, 但是点击后台任意菜单都出错, 请问这可能是什么原因呢? 求 V 友们帮忙看看我的报错日志, 谢谢!



error log:



2020/02/07 07:58:56 [error] 6#6: *108 FastCGI sent in stderr: "PHP message: Uncaught PHP Exception Drupal\Component\Plugin\Exception\PluginException: "Plugin (captcha) instance class "Drupal\captcha\Element\Captcha" does not exist." at /var/www/html/core/lib/Drupal/Component/Plugin/Factory/DefaultFactory.php line 97" while reading response header from upstream, client: 1.2.3.4, server: example, request: "GET /user/1/edit HTTP/1.1", upstream: "fastcgi://172.19.0.3:9000", host: "example", referrer: "http://example/user/1"

2020/02/07 07:59:19 [error] 6#6: *170 FastCGI sent in stderr: "PHP message: Uncaught PHP Exception Drupal\Component\Plugin\Exception\PluginException: "Plugin (captcha) instance class "Drupal\captcha\Element\Captcha" does not exist." at /var/www/html/core/lib/Drupal/Component/Plugin/Factory/DefaultFactory.php line 97" while reading response header from upstream, client: 1.2.3.4, server: example, request: "GET /admin HTTP/1.1", upstream: "fastcgi://172.19.0.3:9000", host: "example", referrer: "http://example/user/1"

access log:

1.2.3.4 - - [07/Feb/2020:07:58:56 +0000] "GET /user/1/edit HTTP/1.1" 500 537 "http://example/user/1" "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.130 Safari/537.36"
1.2.3.4 - - [07/Feb/2020:07:58:56 +0000] "GET /modules/admin_toolbar/admin_toolbar_tools/misc/icons/ffffff/d8-item.svg HTTP/1.1" 200 1499 "http://example/modules/admin_toolbar/admin_toolbar_tools/css/tools.css?pc5ppi" "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.130 Safari/537.36"
1.2.3.4 - - [07/Feb/2020:07:59:00 +0000] "GET /modules/coffee/images/icons/bebebe/coffee.svg HTTP/1.1" 200 1947 "http://example/modules/coffee/css/coffee.css?pc5ppi" "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.130 Safari/537.36"
1.2.3.4 - - [07/Feb/2020:07:59:19 +0000] "GET /admin HTTP/1.1" 500 537 "http://example/user/1" "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.130 Safari/537.36"
1.2.3.4 - - [07/Feb/2020:07:59:23 +0000] "GET /core/misc/icons/ffffff/hamburger.svg HTTP/1.1" 200 510 "http://example/core/modules/toolbar/css/toolbar.icons.theme.css?pc5ppi" "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.130 Safari/537.36"
@gefranks 两位大佬好, 我把日志报错信息贴在 #32 楼了, 能否帮忙看看? 卡在最后这一步, 谢谢!
@manami
2020-02-07 16:40:02 +08:00
回复了 programV2 创建的主题 程序员 求助各位大佬们 登陆 drupal8 后台,点击任意菜单都出错
@dearroy 我通过删掉 recaptcha 和 captcha 两文件夹并进入数据库清缓存来停用 recaptcha 和 captcha 模块, 登陆没有出现验证码终于进入管理后台, 但是点击后台任意菜单都出错, 请问这可能是什么原因呢? 求 V 友们帮忙看看我的报错日志, 谢谢!



error log:



2020/02/07 07:58:56 [error] 6#6: *108 FastCGI sent in stderr: "PHP message: Uncaught PHP Exception Drupal\Component\Plugin\Exception\PluginException: "Plugin (captcha) instance class "Drupal\captcha\Element\Captcha" does not exist." at /var/www/html/core/lib/Drupal/Component/Plugin/Factory/DefaultFactory.php line 97" while reading response header from upstream, client: 1.2.3.4, server: example, request: "GET /user/1/edit HTTP/1.1", upstream: "fastcgi://172.19.0.3:9000", host: "example", referrer: "http://example/user/1"

2020/02/07 07:59:19 [error] 6#6: *170 FastCGI sent in stderr: "PHP message: Uncaught PHP Exception Drupal\Component\Plugin\Exception\PluginException: "Plugin (captcha) instance class "Drupal\captcha\Element\Captcha" does not exist." at /var/www/html/core/lib/Drupal/Component/Plugin/Factory/DefaultFactory.php line 97" while reading response header from upstream, client: 1.2.3.4, server: example, request: "GET /admin HTTP/1.1", upstream: "fastcgi://172.19.0.3:9000", host: "example", referrer: "http://example/user/1"

access log:

1.2.3.4 - - [07/Feb/2020:07:58:56 +0000] "GET /user/1/edit HTTP/1.1" 500 537 "http://example/user/1" "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.130 Safari/537.36"
1.2.3.4 - - [07/Feb/2020:07:58:56 +0000] "GET /modules/admin_toolbar/admin_toolbar_tools/misc/icons/ffffff/d8-item.svg HTTP/1.1" 200 1499 "http://example/modules/admin_toolbar/admin_toolbar_tools/css/tools.css?pc5ppi" "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.130 Safari/537.36"
1.2.3.4 - - [07/Feb/2020:07:59:00 +0000] "GET /modules/coffee/images/icons/bebebe/coffee.svg HTTP/1.1" 200 1947 "http://example/modules/coffee/css/coffee.css?pc5ppi" "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.130 Safari/537.36"
1.2.3.4 - - [07/Feb/2020:07:59:19 +0000] "GET /admin HTTP/1.1" 500 537 "http://example/user/1" "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.130 Safari/537.36"
1.2.3.4 - - [07/Feb/2020:07:59:23 +0000] "GET /core/misc/icons/ffffff/hamburger.svg HTTP/1.1" 200 510 "http://example/core/modules/toolbar/css/toolbar.icons.theme.css?pc5ppi" "Mozilla/5.0 (Windows NT 6.1; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.130 Safari/537.36"
1 ... 59  60  61  62  63  64  65  66  67  68 ... 77  
关于   ·   帮助文档   ·   自助推广系统   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   2705 人在线   最高记录 6679   ·     Select Language
创意工作者们的社区
World is powered by solitude
VERSION: 3.9.8.5 · 29ms · UTC 08:51 · PVG 16:51 · LAX 01:51 · JFK 04:51
Developed with CodeLauncher
♥ Do have faith in what you're doing.