Introduction
The Linux command adduser and addgroup are used to add users and groups to the system. They are used to create new user accounts and groups, as well as to modify existing user accounts and groups. The adduser and addgroup commands are part of the Linux user and group management system, which is used to manage user accounts and groups on Linux systems. The adduser and addgroup commands are used to create, modify, and delete user accounts and groups. They can also be used to set user and group permissions, as well as to assign users to groups.
Examples
The adduser or addgroup command is used to add a user or group to the system. This command is used to create a new user or group account in the system.
Syntax:
adduser [options] username
addgroup [options] groupname
Options:
-h, –help: Display help message
-g, –gid: Specify the group ID
-G, –groups: Specify the supplementary groups
-s, –shell: Specify the login shell
-u, –uid: Specify the user ID
-d, –home: Specify the home directory
-c, –comment: Specify the comment field
Example:
To add a new user with username ‘john’, use the following command:
adduser john
Adding Users and Groups in Linux
Linux is a powerful operating system that allows users to customize their system to their needs. One of the most common tasks is adding users and groups to the system. This article will explain how to add users and groups in Linux using the adduser
and addgroup
commands.
Adding Users with adduser
The adduser
command is used to add a new user to the system. It takes several arguments, including the username, the user’s home directory, and the user’s group. To add a user, use the following command:
adduser <username> -d <home_directory> -g <group>
For example, to add a user named john
with a home directory of /home/john
and a group of users
, use the following command:
adduser john -d /home/john -g users
Adding Groups with addgroup
The addgroup
command is used to add a new group to the system. It takes several arguments, including the group name and the group’s GID (Group ID). To add a group, use the following command:
addgroup <group_name> -g <GID>
For example, to add a group named developers
with a GID of 1000
, use the following command:
addgroup developers -g 1000
Conclusion
In this article, we have discussed how to add users and groups in Linux using the adduser
and addgroup
commands. We have also provided examples of how to use these commands to add users and groups to the system.