Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fanart.jpg文件权限 #100

Open
ky0utarou opened this issue May 6, 2024 · 2 comments
Open

fanart.jpg文件权限 #100

ky0utarou opened this issue May 6, 2024 · 2 comments

Comments

@ky0utarou
Copy link
Contributor

user@sv:/ABC$ ls -lh
total 42M
----------  1 root root  60K May  3 08:00 'ABC-fanart.jpg'
-rwxrwxrwx+ 1 root root  42M May  3 08:00 'ABC.mp4'
-rwxrwxrwx+ 1 root root  476 May  3 08:00 'ABC.nfo'
-rwxrwxrwx+ 1 root root  60K May  3 08:00 'ABC-poster.jpg'
-rwxrwxrwx+ 1 root root 1.2K May  3 08:00 'ABC.zh-CN.default.ass'

user@sv:/ABC$ chmod --reference=ABC-poster.jpg ABC-fanart.jpg
chmod: ‘ABC-fanart.jpg’ is linux mode: Operation not permitted

fanart.jpg似乎是从这里复制出来的,为什么权限和源文件不同且无法更改

@amtoaer
Copy link
Owner

amtoaer commented May 6, 2024

你说的权限无法更改,我理解是因为 chmod 没有用 sudo 执行。
至于权限不同的问题,fs::copy 在标准库文档中明确指出:

This function will also copy the permission bits of the original file to the destination file.

所以我不太能确定你这个是什么情况,没理由默认会把权限设置成这样的,我这里也是正常的(文件夹755,文件644):
image

另外,推荐在 docker 运行时指定 user 选项,这样容器会以用户权限运行,创建出来的内容所有者也都是用户本身而非 root。

@ky0utarou
Copy link
Contributor Author

是的,我当时也觉得标准库不会做额外的事情,应该跟copy的代码没关系

推荐在 docker 运行时指定 user 选项,这样容器会以用户权限运行,创建出来的内容所有者也都是用户本身而非 root

确实是这个问题,改成host用户的uid和gid之后权限就正常了

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants