So you can see, Linux user and group is an essential part of Linux security. In this article, I will show you how to add a user to a group on CentOS 7. Let’s get started. Creating a Group on CentOS 7: In this section, I am going to show you how to create a new group on CentOS 7. For adding new users in system there are two commands available in your system, useradd and adduser. Adduser command is the enhanced version of useradd command. Adduser command uses useradd command in backend. This tutorial will help you to add and delete user on CentOS, RHEL, Fedora and CoreOS operating systems.
Add User To Chromebook
useradd is a low-level utility to create new users to the system. When used without the -D option, useradd command will create a new user account using the command line plus the default values ??of the system. Depending on the command line option, useradd command will update system files and also can create new user’s home directory. In this article, I will explain to you how to create a user then add it to the particular group in CentOS 5 and CentOS 6. Prior to that , this article assumes that the server CentOS 5 or CentOS 6 has been fully installed.
1. Add a new user. In this example, the username will be ‘myroot‘.
2. Check current groups for ‘root‘ user.
3. Add ‘myroot‘ into root group as below:
useradd -G {group-name} username
Centos Add New User
Above is example, we are adding a user ‘myroot‘ into group ‘root‘.
4. Switch to ‘myroot‘ user. Then Check current group for ‘myroot‘. root group will be the second group for ‘myroot’.
5. Grep the ‘myroot’ user’s group.
6. Check the file permission for /etc/passwd
Explanation : Only the owner which is ‘root’ user can edit the /etc/passwd file, not in the root’s group.