If you have installed Debian without a
root password, you will automatically have
sudo enabled for the user account that you have created during the installation.
When you enable the
root account, always disable
sudo. You should never have both enabled, as it doubles the surface for malicious software or actors to compromise the system.
rootaccount, just give it a password. Open a terminal and type:
sudo passwd root
into it, and press Enter.
sudoin the same terminal within the last 15 minutes). Type your password and press Enter.
Enter new UNIX passwrod:
Enter the new root password, and press Enter. The cursor will not move. This is intentional so that the length of the new password is harder to guess by anyone with a malicious intent.
Retype new UNIX passwrod:
Confirm your password and press Enter
rootaccount. To test it, type the following command:
and press Enter.
rootpassword and press Enter. If there is no error, and the prompt changes to
root@yourhostname#, it all worked fine.
Now you should disable
sudo, so you have only one way to access
root. To do this, it is possible to just remove the user from the
sudo group. This might be fine if you are the only user on the computer, but if it's a multi-user system, you might want to completely remove
sudo instead. To avoid confusion and any later problems, we'll opt for the second option. While still at the
root prompt, type:
apt purge sudo
and press Enter. This should remove sudo completely from your system.
apt command will be discussed in greater detail in [Discover Debian / installing Applications](/configuring/install-applications/install-new-applications/install from the cli)
and press Enter.
And you are done. You can close the terminal now.
Although there is no standalone script provided for these simple tasks, the Way of Linux Admin console app, available from the Downloads page, hs pre-configured menu options that can make these tasks a lot easier.