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
Replaceusername
with the desired username:
1 |
sudo adduser username |
- Add User to the Sudo Group
By default, users in thesudo
group have sudo privileges:
1 |
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:
1 |
sudo visudo |
Then, add the following line at the end of the file:
1 |
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
, thenY
andEnter
to confirm).
The user now has sudo privileges and can run commands without entering a password.