How to Create Users in Linux (useradd Command)
NAME:
adduser – add a user to the system
SYNOPSIS:
adduser [options] [–home DIR] [–shell SHELL] [–no-create-home] [–uid ID] [–firstuid ID] [–lastuid ID] [–ingroup GROUP | –gid ID] [–disabled-password] [–disabled-login] [–gecos GECOS] [–add_extra_groups] user
adduser –system [options] [–home DIR] [–shell SHELL] [–no-create-home] [–uid ID] [–group | –ingroup GROUP | –gid ID][–disabled-password] [–disabled-login] [–gecos GECOS] user
when we try to create user, we have these questions:
- Username: The username or login name should be between 1 to 32 characters.
- Password: password save in /etc/shadow file in an encrypted format
- User ID (UID): The user id is 1004. (“0” is for root user)
- Group ID (GID): The group id is “1004” and save in directory “/etc/group”
- User Info: information like Full name, Room Number, Work Phone, Home phone, Other
- Home Directory: path is “/home/username”
- Shell: user is “/bin/bash”
The Sudo utility allows users to run programs while using the security privileges of another user, usually root (superuser). The function of Sudo is like “run as” in Windows system.
Steps to set up and run Sudo (to run all commands as administrator). If the system is not already configured and enabled to use Sudo, changes must be made so that a non-root user can manage the system.
• In the command line, enter the command :
> su
You will be prompted for the root password.
Create username:
> adduser <user_name> sudo
> Sudo adduser user1
You can find other learning for Linux by clicking here.