You may verify the creation of the new user by checking the content of the /home directory or grep on the username in /etc/passwd file. After confirmation, the user will be created successfully. You may enter the details if you want to, but it is not mandatory. It also asks for details for name, phone numbers, and others. With the adduser command, the home directory for the user is also created. Here's a sample screenshot for the creation of a new user named handbook: You may also use Ctrl+U Linux shortcut to delete the entire line and start from the beginning. When you type your password, it will be invisible, but you can also use delete or backspace whenever you like. You can read the difference between adduser and useradd here. You can either adduser or useradd command for adding a new user. This is to ensure that only people who are having rights over the system or in charge of protecting the system are creating new users and nobody else. Visudo makes sure that sudoers is edited by one user at a time and provides necessary syntax checks. It is recommended to use visudo to edit the sudoers file. To create a user, one must be a sudoer or a root. To edit /etc/sudoers file, use following command: sudo visudo -f /etc/sudoers. Note: Adding a new user will also create a user group named the same as the user in Ubuntu. You add it to the sudoer list in the next step. To create a new user, enter the following command: rootlocalhost adduser USERNAME To set the password of. Keep in mind that the user will be a regular user when you create it. Log in as the root user on the desired server. If the user that you want to grant sudo access doesn't exist, the first step would be to create that user. After that, you will be asked to enter values for the user information e.g. Please check the users present on your Linux system. Create a new user account with the adduser command and use a strong password. Let’s now get started on creating a sudo user or sudoer in Linux command line. However, I am not sure if all Linux distributions have a group named sudo. The commands used here are standard Linux commands and these should be installed on most Linux distributions by default. I am using Ubuntu in this tutorial, but the steps mentioned here should apply to Debian and many other Linux distributions as well. That was too short, right? Don't worry! I explain the steps in detail. I'll just show how you can add a sudo user to Ubuntu or Debian. In Ubuntu and Debian-based Linux systems, sudo is practically synonymous with root but in reality, sudo is much more than that.īut I am not going to go into details on sudo here. You just add sudo before the command to run it with root privilege. Typically, these privileges are only accessible to the root user. You don't need to know the root password or switch to root user. With the sudo command, you can grant certain users special administrative privileges. After that, you will be able to use the sudo command with your current user in Debian 12 Linux systems.As a sudo user, you can run commands and access files as root user but with your own password. Log out and Log in again to apply the changes. Save the file by pressing Ctrl + O and exit the file by using the Ctrl +X keys. Note: Replace the username with the user that you want to add to the sudo group in Debian 12 BookWorm.įor example, here our username is linuxshout, thus the above command will be like this: linuxshout ALL=(ALL:ALL) ALL Scroll down to the end of the file and add the following line. Now, edit the sudoers file using the given command. Switch to the root user, if you already have not. In this method, we directly edit the Sudoers file to add the user to it. In case, due to any reason, the previously explained method couldn’t add your current user to the sudo group in Debian 12 then here is another. Note: Replace username with the name that you want to give your new user. The above command will allow you to add a new user. Now, use the given syntax: usermod -aG sudo linuxshoutĬhange the linuxshout in the above command with your current system user that you want to add to the sudo group.Īfter that refresh the sudo group: newgrp sudoįurthermore, if you don’t have any other user apart from root or you want to add a new user then run: adduser username You may get an error while usermod that the command is not found, soįirst, run this: ln /usr/sbin/usermod /usr/bin Now, I am assuming that you already have a user on your Debian system that you want to add to the sudo group for running commands under root rights. su - Add your current user to the Debian 12 sudo group When it asks for the password enter the one you have set for your Debian 12 root user. So, use the given command and first switch to the root user. Add your User Add user to sudoers group in Debian 12Īs our current user doesn’t have sudo rights on Debian, therefore we cannot add it to the sudo group with accessing Admin privileges.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |