![]() The fourth ALL specifies that this rule applies to all commands.The third ALL specifies that the root user can execute commands as all groups.The second ALL specifies that root user can execute commands as all users.The next parameter (ALL) specifies that this rule applies to all hosts.The first parameter (root) specifies the user that the rule applies to.Let’s look at the default configs first, starting with the root ALL=(ALL:ALL) ALL rule. Keep in mind that you should never edit this file with a normal text editor, you should always use visudo. You can instead assign specific permissions to certain users and groups by editing the /etc/sudoers file. But as stated, this isn’t ideal in terms of security. Add the User to the sudoers Fileīy default, all sudo users have super-user privileges. For instance, you could run sudo whoami or sudo cat /etc/sudoers. Or you can simply use su kal switch to the new account and test directly. You can run id kal or groups kal and confirm that sudo is listed. There are various ways to verify the change. Now, append the user to the sudo group with sudo usermod -aG sudo kal Set a password for the user with sudo passwd kal Add the User to the Sudo Group Note: The -m option in adduser creates a home directory for a new user in Ubuntu automatically. Now, type the following command to create a new user sudo useradd -m kal Create a New Userīefore you start, you can check the members of the sudo group with getent group sudoĪdditionally, you’ll need root access to add a sudo user. ![]() This allows you to assign permissions on a least privilege basis instead of giving blanket root access to all sudo users, which is much more secure. But you can also customize the permissions sudo provides to various users and groups, including the sudo group itself. In practice, this usually means that users in the sudo group can run programs with root privileges.Īdding sudo users in Ubuntu is a very simple process, and most users stop there. By following the steps outlined in this article, you can easily create a sudo user in Ubuntu and grant them administrative privileges.Sudo, also known as Super User Do, is a program that lets users execute commands with the specified privileges. It allows you to delegate administrative tasks to a user account while limiting the risk of system damage. ConclusionĬreating a sudo user in Ubuntu is an essential step in securing your system. If the user has administrative privileges, the system will return ‘root’ as the output of the command. To verify that the new user has administrative privileges, run the following command: sudo whoami If the password is correct, you will log in as the new user. Here, replace ‘username’ with the name of the user you created in step 2.Įnter the password for the user when prompted. Once you have added the user to the sudo group, you can verify whether the user has administrative privileges or not by running the following command: su - username Here, replace ‘username’ with the name of the user you created in step 2. Run the following command to add the user to the sudo group: usermod -aG sudo username To do this, you need to add the user to the sudo group. The next step is to grant administrative privileges to the newly created user. You will be prompted to set a password for the new user. Here, replace the ‘username’ with the name you want to give to the new user. You can create a new user account by running the following command: adduser username Once you have logged in as the root user, the next step is to create a new user account. To do this, open a terminal window and enter the following command: sudo su -Įnter your password when prompted to gain root access. Step 1: Log in as Root Userīefore creating a sudo user, it’s essential to log in as the root user. In this article, we will guide you on how to create a sudo user in Ubuntu. ![]() Therefore, it is recommended to create a sudo user in Ubuntu to manage the system’s administrative tasks while limiting the risk of system damage.Ī sudo user is a regular user account that has been granted administrative privileges, allowing them to perform tasks that require root access without logging in as the root user. However, giving full access to the root user can be risky, as it can lead to unintended system changes or even system failure. In Ubuntu, the root user has full access to the system, which means that they can perform any task or modify any file without any restriction.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |