我遇到了 docker 的问题,因为 docker 将使用 UID 1000 写入文件,但我在主机中的 UID 是 1001。
一个解决方法是将我的主机用户的 UID 更改为 1000,这意味着
将主机系统中的现有用户 UID 从 1000 更改为 1002
将主机系统中所需的用户从 1001 更改为 1000
问题: usermod 实际上会正确更新所有文件和文件夹权限吗?
答案1
-u, --uid UID
The new numerical value of the user's ID. [...]
The user's mailbox, and any files which the user owns and which are located in the
user's home directory will have the file user ID changed automatically.
The ownership of files outside of the user's home directory must be fixed manually.
The change of the user ownership of files inside of the user's home directory is also
not done if the home dir owner uid is different from the current or new user id. This
is a safety measure for special home directories such as /.
它可以修复上述某些文件的所有权,但不能修复权限不管怎样。