Content

Add or remove a user on the Linux servers of DC3 and DC2 server plans

These instructions cover adding and removing users on a Linux server. The process may differ between Red Hat and Debian distributions, where you may be prompted for a password and additional user information.

To add a user, for example "introserv" you need to enter the command:
*note that on a Red-Hat based system you will need to add a password for the user manually.

Create a user:

adduser introser

Set password- (для Red-Hat ):

passwd introserv

The following actions will be performed as a result of executing the adduser command:
- a new user with the name "introserv" is created
- a group with the same name is created.
- a home directory of the user is created in the directory /home/introserv
- files from the /etc/skel directory are copied to the home directory.
This directory contains files that are copied to the home directory of all new users.

The adduser command is simpler and is recommended in most cases, but it is not available in all Linux distributions. You can use a low-level utility to create users in Linux -useradd

  Create a user:

useradd introserv

Set a password for the user:

passwd introserv

This command creates a new user with system defaults, which are specified in the /etc/default/useradd file

To add a new user to the sudo group, you must enter the following command:

For Debian systems:

usermod -aG sudo introserv

For Red-Hat systems:

usermod -aG wheel introserv

To remove a new user from the sudo group, you must enter the following command:

 For Debian systems:

gpasswd -d introserv sudo

 For Red-Hat systems:

gpasswd -d introserv wheel

To delete a user, you must enter the following command:

deluser introserv

Important! When using the deluser command, you must also delete the user's home directory using "--remove-home" because deluser deletes the user without destroying the home directory:

--remove-home introserv

Note that the commands may differ depending on the Linux distribution you choose.