Changing user settings
The UID, GID, and home directory are specified in advance for the user. If you want to change these information later, use the usermod command.
The usermod command can only be executed by root, and it allows you to change various user information. (It is also possible to change the user name).
●Change the user group.
[root@lion root]# id nuy ←Display group information for user nuy with id command uid=502(nuy) gid=503(nuy) ←Group affiliation=503(nuy) [root@lion root]# usermod -u 5000 nuy ←Change the user group to 5000 using the usermod command. [root@lion root]# id nuy uid=5000(nuy) gid=503(nuy) ↑The user group has been changed to 5000 |
●Change the primary group.
[root@lion root]# usermod -g tama nuy ←Change the primary group to tama [root@lion root]# id nuy uid=5000(nuy) gid=500(tama) ←Group affiliation=500(tama) ↑Primary group has been changed to tama. |