AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |
Back to Blog
Make a sudo user ubuntu11/25/2023 ![]() ![]() So, once logged in as a user, you can verify whether or not the user belongs to group=sudo using either the id or group commands. It is always a good practice to verify before you run any command on a production system. Step 1: Log in to your server as the root user. The guide is not by any stretch of imagination exhaustive but whatever is not clear or if you wish to extend what you intend to do, the man pages and search engines will be great sources of light. The commands used here are standard Linux commands and these should be installed on most Linux distributions by default. This guide will show you the easiest way to create a new user with sudo access on Ubuntu and Debian-based Linux distribution without having to modify your server's sudoers file. How to create sudo user on Ubuntu and Debian-based Linux distribution auditing/logging: when a sudo command is executed, the original username and the command are logged.it's easy to run only the commands that require special privileges via sudo the rest of the time, you work as an unprivileged user, which reduces the damage that mistakes can cause.Extra privileges can be granted to individual users temporarily and then taken away without the need for a password change. ![]() nobody needs to know the root password (sudo prompts for the current user's password).Using sudo is better (safer) than opening a session as root for a number of reasons, including: These changes can wreck or uplift the experience of everyone using the system. Remember to choose a strong and secure password for the new user, and always use sudo responsibly to avoid unintended modifications to the system.When a normal Linux user is move to that special group that turns the wheel, "sudoer" right is granted, he or she gains immense powers and can make system-wide changes. By following the steps outlined in this tutorial, you can create a new user with sudo privileges on your RHEL, Rocky Linux or Alma Linux system. If the new user has sudo privileges, it will be prompted to enter their password before the command is executed.Ĭreating a sudo user is an essential step in securing your Linux system. Login to your system as regular user and try installing a package ‘net-tools’įor example, you can try updating the system using the following command: $ sudo dnf install net-tools To verify that the new user has sudo privileges, you can try running a command that requires administrative privileges using the sudo command. Let’s assume, we want eric user to be added to wheel group then run # usermod -aG wheel eric This command adds the existing user to the wheel group, which allows the user to run commands with administrative privileges using the sudo command. Replace with the name of the new user you just created. To add the user to the wheel group, enter the following usermod command: To grant sudo privileges to the existing users, you need to add the user to the wheel group. Step 3: Grant Sudo Privileges to existing Users Perfect, output above confirms that user is a part of wheel group. Run following id command to verify that whether user is part of wheel group or not. Make sure to choose a strong and secure password. To set a password for the new user, enter the following command: # passwd This command creates a new user account with a home directory and a default shell of /bin/bash.Įxample # useradd -G wheel -s /bin/bash opsadmĪfter creating the user, you need to set a password for the user. Replace with the name of the new user you want to create. While creating a new user, one assign sudo privileges to it using following useradd command, Now that you are logged in as the root user, you can create a new user account. Step 2: Create a New Regular User & assign Sudo Privileges After entering the correct password, you will be logged in as the root user. # ssh will be prompted to enter the root user password. Open the terminal window.Īlternate way: If your linux server is on network, then ssh it is using root user credentials. To create a sudo user, you will need to log in as the root user on your Linux system. Step 1) Access Your System with Root User When we add any regular to wheel then that user will have administrative rights. In Linux distros like RHEL, CentOS, Rocky Linux & Alma Linux, a wheel group is created automatically during the installation. ![]()
0 Comments
Read More
Leave a Reply. |