How to Add a New User and Grant Sudo Permissions on Debian
For server security reasons, when xiaoz sets up a new server, they typically create a new user, grant that user sudo privileges, and then disable the root user. This article records and shares the method for performing these operations on a Debian system.

Add a New User on Debian
Simply execute the following command:
# Replace newuser with your desired username
sudo adduser newuser
The adduser command is unique to Debian-based systems (including Ubuntu) and does not exist in Red Hat-based systems. Executing this command automatically creates the user, user group, and home directory, and prompts you to set a password and other user information.

Grant Sudo Permissions
Some Debian systems may not have the sudo command installed by default. You can install it first using the following command (requires root user access):
apt-get install sudo
After installation, execute the following command to add the new user to the sudo group (requires root user access) so they can obtain administrator privileges:
# Replace newuser with the username from the previous step
usermod -aG sudo newuser
Test
Next, switch to newuser and test if sudo is working correctly.
# Refresh permissions to take effect immediately
newgrp sudo
# Switch to newuser
su - newuser
# Test sudo permissions; if no errors occur, it is working normally
sudo pwd
Conclusion
Creating a new user and granting sudo privileges on Debian-based systems is very simple. It can be completed with just a few commands. Compared to Red Hat-based systems, there is no need to modify configuration files, making it more convenient.