11/14/2023 0 Comments Set a user as sudo in linuxIf 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
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |