wahyd4 / aria2-ariang-x-docker-compose

Docker compose files for Aria2+ AriaNg+ filerun/ Nextcloud/ h5ai + Plex. 图形化BT,磁力,离线下载,文件管理,播放,投屏
1.79k stars 281 forks source link

为什么aria2下载的文件都是root权限 #44

Closed channelsray closed 6 years ago

channelsray commented 6 years ago

default

wahyd4 commented 6 years ago

因为这个镜像里面执行程序的用户就是root用户。 On Sat, 18 Aug 2018 at 10:52 pm, bigdream notifications@github.com wrote:

[image: default] https://user-images.githubusercontent.com/20846732/44299447-8fb7b200-a328-11e8-9d51-d784e5111a6d.PNG

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/wahyd4/aria2-ariang-x-docker-compose/issues/44, or mute the thread https://github.com/notifications/unsubscribe-auth/AAzD4Mpnb0D68Q1z_GG1lHPT7rEpqjHIks5uSA38gaJpZM4WCjv0 .

channelsray commented 6 years ago

这样我aria2下载的文件只有可读的权限了,没法删除

wahyd4 commented 6 years ago

容器外面的用户和容器里面的用户是不一样的。容器里面可以使用非root用户,但是并不能使用你当前宿主机的用户(非root)。

我不认为在你不使用root用户运行docker的情况下,我改变了容器内用户为非root用户能解决问题。

建议目前使用root用户来运行docker本身

或者你也可以尝试修改docker-compose.yml,为 aria2 service添加privileged属性,以获取 root 权限

aria2: image: wahyd4/aria2-ui:nextcloud privileged: true

On Sat, 18 Aug 2018 at 10:56 pm, bigdream notifications@github.com wrote:

这样我aria2下载的文件只有可读的权限了,没法删除

— You are receiving this because you commented.

Reply to this email directly, view it on GitHub https://github.com/wahyd4/aria2-ariang-x-docker-compose/issues/44#issuecomment-414056137, or mute the thread https://github.com/notifications/unsubscribe-auth/AAzD4GF_bXY_OuJra9g4PTCm8igH-cDxks5uSA7ygaJpZM4WCjv0 .

channelsray commented 6 years ago

确实是使用root用户登录的,只不过是aria2下载的文件是root才有写的权限,但是nextcloud只有991的权限,使得aria2下载的文件只有读没有写的权限

wahyd4 commented 6 years ago

不太理解你说的991的问题,本程序中的 nextcloud 也是使用 root 用户的。而且经过之前的修复 https://github.com/wahyd4/aria2-ariang-x-docker-compose/issues/38

使用 root 用户不能删除文件的权限的问题应该已经解决了。

channelsray commented 6 years ago

我这里nextcloud 运行和文件夹权限就变成991了。。 default

wahyd4 commented 6 years ago

你这个 nextcloud 是什么目录? 991 是用户 ID 和用户组 ID 吧,不是权限。 是你宿主机自己设置的,还是被容器创建的?

channelsray commented 6 years ago

我查看了以下#38用的是官方的nextCloud,#39又切换回去了

wahyd4 commented 6 years ago

是,现在是用的第三方做的镜像,因为官方镜像,在启动时,需要下载几十M的文件,导致在国内很可能下载启动不成功。

但是这个和权限没啥关系,主要是之前我没有对目录手动添加rw权限导致的 On Sun, 19 Aug 2018 at 12:30 am, bigdream notifications@github.com wrote:

我查看了以下#38用的是官方的nextCloud,#39又切换回去了

— You are receiving this because you commented.

Reply to this email directly, view it on GitHub https://github.com/wahyd4/aria2-ariang-x-docker-compose/issues/44#issuecomment-414061963, or mute the thread https://github.com/notifications/unsubscribe-auth/AAzD4F0MmgEhiIQhSehmubjLOHfwfE1Xks5uSCUVgaJpZM4WCjv0 .

channelsray commented 6 years ago

nextcloud 是被容器创建的目录,创建开始是root权限,进入网页之后更新为991权限,

wahyd4 commented 6 years ago

刚查了 Nextcloud 镜像的文档, 991是他们默认设置的用户ID 和用户组 ID, 是可以通过环境变量覆盖的。修改 docker-compose.yml 中,nextcloud 镜像里面的参数即可 https://github.com/Wonderfall/docker-nextcloud#environment-variables

environment:
   - UID=
   - GID=

就可以手动绑定,让容器和宿主机运行于同样的用户了。 我后期也会更新代码让 Aria2 镜像也能支持绑定 UID 和 GID

channelsray commented 6 years ago

对,我也查了,但是nextClout还需要修改三个地方,他默认禁止root 第一个:修改/php/etc/php-fpm.comf image 添加user和group为root的选项 第二个: 修改/etc/s6.d/php/run image 加上 -R 允许root 启动 第三个: 修改/nginx/conf/nginx.conf image 添加 user root root;修改为root启动