To add a new user account with administrative privileges on Linux, you will need to log in as the root user or another user with sudo privileges. Once logged in, you can use the following steps to create a new user and grant them administrative privileges:
useradd
command to create a new user account. Replace <username>
with the desired username for the new account:useradd <username>
passwd
command. Replace <username>
with the username of the new account:passwd <username>
sudo
group using the usermod
command. Replace <username>
with the username of the new user:usermod -aG sudo <username>
sudo
command to run commands with administrative privileges. You can verify that the user has been added to the sudo
group by running the following command and checking the output for the sudo
group:groups <username>
Note: The steps above are for systems that use the sudo
command to grant administrative privileges. If your system uses a different method to grant administrative privileges, you may need to use a different set of steps to add a user with admin access.