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
The easiest way to create without user configuration is as follows:
adduser user_name -p p@ssw0rd
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
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 "Новый участник"
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
All steps in the tutorial can be performed on powerful cloud servers. Serverspace provide isolated VPS / VDS servers for common and virtualize usage.
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
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.