Serverspace Black Friday
JT
May 16, 2024
Updated July 12, 2024

How to Create Common and Sudo Users for Rocky Linux?

Linux Maintenance

Having basic management skills in Rocky Linux makes it easier for the user to interact with the OS and form an idea of how the system works. One of these is to create a user with various options.

How do I create a regular user?

To create a new account, the adduser utility is used, or its equivalent useradd, there is practically no difference in their functionality. Here is a list of available options for the utility:

adduser -h
Manual of command
Screenshot №1 — Manual of command

The easiest way to create without user configuration is as follows:

adduser user_name -p p@ssw0rd
Quick user creation
Screenshot №2 — Quick user creation

The result of the team's work: a new account with a standard set of settings. You can view them by specifying the -D option, which will display all the standard user settings:

adduser -D
Default settings
Screenshot №3 — Default settings

If necessary, you can change these parameters through the configuration file with the command:

nano /etc/default/useradd

For example, by specifying a different shell for users or the expiration date of their accounts. For more flexible configuration, we will specify a manual shell, a directory and a comment.

adduser user_name -p p@ssw0rd -d /tmp -s /bin/bash -c "Новый участник" 
User creation
Screenshot №4 — User creation

When checking the list of accounts with the cat command, we see that the user_name has appeared, which means the process has been completed successfully.

How do I create an administrator?

In Linux-like systems, the administrator is an account that has been delegated root rights through the sudo utility. By default, there are groups that grant the user administrator rights if he is added to them. Therefore, when creating an account, we will explicitly specify the group where the user needs to be added:

useradd admin -G wheel -p complexpass
Admin creation
Screenshot №5 — Admin creation

All steps in the tutorial can be performed on powerful cloud servers. Serverspace provide isolated VPS / VDS servers for common and virtualize usage.

Create Server
Screenshot №6 — Create Server

It will take some time to deploy server capacity. After that you can connect in any of the convenient ways. Let's return to explore utility. If you need to create a new root user, use the record duplication function to do this:

adduser root_new -u 0 -o -p complexpass
Create new root
Screenshot №7 — Create new root

Optionally, you can also specify a group with gid = 0, as well as the original root through the additional option -g 0. So those who will be in the wheel group or the root group will receive privileges to work with files in front of other users.

Vote:
5 out of 5
Аverage rating : 5
Rated by: 1
33145 North Miami, FL 2520 Coral Way apt 2-135
+1 302 425-97-76
700 300
ITGLOBAL.COM CORP
700 300

You might also like...

We use cookies to make your experience on the Serverspace better. By continuing to browse our website, you agree to our
Use of Cookies and Privacy Policy.