How to add a user in Linux, Linux operating system lecture course Baku

How to add a user in Linux, Linux operating system lecture course Baku

Articles

Working with Linux has become an integral part of many new areas of the IT sector. Therefore, knowledge of system administration will significantly simplify employment from scratch. Today, we'll cover how to add an account to the OS; this knowledge is included in the Linux operating system lecture course in Baku . It's also important for anyone planning to become an IT specialist in Azerbaijan in 2023.

Command to add a new user, Linux operating system lecture course Baku

First of all, let's agree that we're talking strictly about using the command line interface (CLI ). Of course, many Linux operations can also be performed using the graphical user interface (GUI ), as is likely the case for users who work extensively with Microsoft Windows operating systems.

However, this doesn't mean you'll always be able to do the same in your work. For example, servers most often don't have a GUI . The specific method for performing the same actions graphically will vary depending on the distribution.

At the same time, the commands will almost always be similar, if not identical. Even different members of the GNU/Linux family are striving for unification of approaches (especially after 2020). Our instructors will explain this in more detail if you enroll in the Linux security course in Baku , which can be taken online in Azerbaijan on the SEDICOMM University platform in 2023.

To add a new account, enter sudo useradd <username> into the command line and press Enter to execute it. This command will create new entries in the following files:

  • / Etc / passwd — a file containing a list of users UNIX-like OS;
  • / Etc / shadow — a similar file containing a list of user passwords;
  • / Etc / group — a file that stores the names and numeric identifiers of user groups (GID).
  • / etc / gshadow — a file containing protected data about user groups.

To set a password for a previously created account, enter the following command in the command line: sudo passwd <username> and press Enter . The command shell will prompt you to enter and re-enter the password. If the password is entered the same way both times, it will be set for the previously created account.

It's also a good idea to create a home directory for the new account. By default, most modern Linux distributions don't create one with the useradd command. To do this, enter sudo useradd -m <username> in the command line . Linux torrent Baku courses will cover this and much more in detail.

How to add a new user to a group

You'll likely need to add a new user account to a group so you don't have to grant them the appropriate privileges separately. The easiest way to do this is with the following command: sudo usermod -a -G <group name> <username> . Be sure to include both options:

  • -G — is responsible for adding an account to the specified group;
  • -a - without this option, all values ​​of groups the user is a member of will be overwritten.

It's worth noting that you may need to grant the user sudo privileges . To do this, add their account to the wheel group . Remember that superuser privileges should only be granted when truly necessary. And always consider the potential consequences of improper use of root privileges . To learn more about this, we recommend taking the Linux online courses in Baku.

SEDICOMM University Team : Cisco Academy , Linux Professional Institute , Python Institute.