How to add users to a system?
In this guide, we will describe how to handle the user creation on one of your VM's . You can check the manual of your distribution in the terminal with
This article goes hand in hand with the Group creation Article.
2. How to Add a New User in Linux
The basic syntax of the command is:
To create a user you need to have adequate permissions on the system. You can either get them while logging in as the root user or with the(superuser do) command. By default, a group with the same name will also be created for the new user.
3. Create a User
As a privileged user run
Depending on the distribution you might already be asked for an password while the creation. If not and in the case that your user doesn't have shell access but needs RDP or other services which are depending on the native authentication create a password with the
Thewill create a home directory for af new user under /home. This option is needed when your user should be authenticated with an SSH key.
(Group) flag will add your_user to previously created groups. How to create groups
Sometimes, you want to add a user which has nothing to do with the login shell. You can assign a different login shell with the
4. Other options
4.1. Add an User with an expiry Date
You can use the
The format is YYYY-MM-DD. This is helpful for creating temporary accounts for a specific period of time.
4.2 Do not create a Home directory
You're supposed to run the command with all the flags at the same time. Check the man page for all available options
5. Add an SSH key
It is a good choice to add an SSH key while creating an user.