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.

How useful was this article?

VAT

  • Other

    Other

    0%
  • austria

    Austria

    20%
  • Belgium

    Belgium

    21%
  • Bulgaria

    Bulgaria

    20%
  • Croatia

    Croatia

    25%
  • Cyprus

    Cyprus

    19%
  • Czech Republic

    Czech Republic

    21%
  • Denmark

    Denmark

    25%
  • Estonia

    Estonia

    22%
  • France

    France

    20%
  • Finland

    Finland

    24%
  • Germany

    Germany

    19%
  • Greece

    Greece

    24%
  • Hungary

    Hungary

    27%
  • Ireland

    Ireland

    23%
  • Italy

    Italy

    22%
  • Latvia

    Latvia

    21%
  • Lithuania

    Lithuania

    21%
  • Luxembourg

    Luxembourg

    17%
  • Malta

    Malta

    18%
  • Netherlands

    Netherlands

    21%
  • Poland

    Poland

    23%
  • Portugal

    Portugal

    23%
  • Romania

    Romania

    19%
  • Slovakia

    Slovakia

    20%
  • Slovenia

    Slovenia

    %
  • Spain

    Spain

    21%
  • Sweden

    Sweden

    25%
  • USA

    USA

    0%
european
states
  • Other
  • canada
  • poland
  • european-union
  • france
  • germany
  • austria
  • austria
  • austria
  • austria
  • austria
  • austria
  • austria
  • austria
  • austria
  • austria
  • austria
  • austria
  • austria
  • austria
  • austria
  • austria
  • austria
  • austria
  • austria
  • austria
  • austria
  • austria
  • austria
  • austria
  • austria
  • austria
  • austria
  • austria
  • austria
  • austria