To create a group call developers type in the following command:
- su to get root access
- groupadd developers to add the group developers
3. Now we want to assign John and Jason to the developers group, with this command useradd john -G developers and repeat the command with jason
As you can see we used the usermod command instead of the useradd command because john, and jason already exists.
4. Now let's assign a group to the user on creation using the useradd command useradd -s /bin/bash -d /home/dora -m dora -G developers
In the command above we added a new user called dora and assigned her to developers group at the same time. The -G option indicates that we want to assign a default group to the user.
5. Now to verify we are going to list the members of the developers group with this command grep 'developers' /etc/group this command searches for entry for the developers group in the /etc/group file
6. Now let's say John is a bad developer and always brings down the server with his infinite loops. We can use this command to remove John from the developers group gpasswd -d john developers
Similar Posts:
- Linux CentOS In-Depth: Adding A New User With useradd and usermod Command
- Linux: Switching To root User With The sudo Command On Ubuntu Server
- Linux: Find Out Which Shell You Are Using
Thanks for a very interesting blog. What else may I get that kind of info written in such a perfect approach? I’ve a undertaking that I am simply now operating on, and I have been at the look out for such info. Apache Kafka
ReplyDelete