更改Linux中用户的用户ID,但不要触及主目录中的文件

更改Linux中用户的用户ID,但不要触及主目录中的文件

我想更改 的用户 ID www-data,但不想更改主目录中的文件。

usermod 手册页:

   -u, --uid UID
       The new numerical value of the user's ID.

       This value must be unique, unless the -o option is used. The value must be non-negative.

       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.

那么有没有一种方法可以在没有副作用的情况下执行此操作,或者我是否必须使用类似的方法/etc/passwd手动编辑?sed

相关内容