4

Linux usermod 命令修改用户UID

 1 year ago
source link: https://www.myfreax.com/usermod-command-to-modify-user-uid/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

Linux usermod 命令修改用户UID

UID是User Identifier的缩写,UID是Linux系统分配给每个用户的唯一标识号

Updated At 12 Nov 2022 2 min read
By myfreax
Linux usermod 命令修改用户UID

Linux usermod 命令修改用户UID

UID是User Identifier的缩写,UID是Linux系统分配给每个用户的唯一标识号。UID 号的主要作用是向Linux内核标识用户。

它用于管理用户对系统资源的访问。这是为每个用户使用唯一UID的原因之一。否则,如果在一个UID两个用户,那么两个用户资源都可以互相访问。

usermod是一个命令行程序,可让您修改用户的登录信息和所属组。本教程介绍如何使用usermod命令修改用户UID。

usermod命令的语法形式是usermod [options] USERoptionsusermod命令的选项,是一个可选参数。USER是Linux系统用户名。

只有root用户或具有sudo权限的用户才能运行usermod命令并修改用户帐户。usermod成功后不打印任何输出,且退出代码是0。

要更改用户UID,使用-u选项调用usermod命令,后接新的UID和用户名。

在修改用户的UID时,usermod命令将会帮助你修改用户在家目录拥有所有权的文件,包括用户的邮箱文件。其他文件的所有权必须手动更改。

例如命令sudo usermod -u 1050 myfreax,将会修改myfreax用户的UID为1050。

#usermod -u UID USER
sudo usermod -u 1050 myfreax
usermod-command-in-linux.webp
Linux usermod命令修改用户信息与组

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK