To create a user with sudo privileges on Debian 12, allowing them to run commands without needing to type a password, follow these steps:
- Create the User
Replaceusernamewith the desired username:
sudo adduser username
- Add User to the Sudo Group
By default, users in thesudogroup have sudo privileges:
sudo usermod -aG sudo username
- Edit the Sudoers File
To allow the user to run sudo commands without typing a password, edit the sudoers file:
sudo visudo
Then, add the following line at the end of the file:
username ALL=(ALL) NOPASSWD:ALL
Replace username with the actual username you created.
- Save and Exit
Save the changes and exit the editor (fornano, pressCtrl+X, thenYandEnterto confirm).
The user now has sudo privileges and can run commands without entering a password.