@fac6cf02e05721918677a669a7
root
is the default user on most Linux OS’s, and you would’t want to change or remove that user as the OS relies on that user existing. Changing the username by altering it, or removing it completely would render the OS unusable and you’d have to boot from recovery or start from scratch.
What you’d want to do, ideally, is create a sudo
user. You’d start by creating a basic user first:
useradd myuser
… and then you’d add that user to the sudo
group.
usermod -aG sudo myuser
The above command adds myuser
to the sudo
group, but doesn’t change the primary group.
From there, you’d want to set a password on the user (if you’re not using SSH Keys):
passwd myuser
You’ll be prompted to type in a password and then confirm it by typing it in again. Once the password is setup, you’ll want to try and login with the new sudo
user and make sure you can escalate. So I’d run something that requires root
.
sudo apt-get update
You’ll be prompted to enter in your password. If it succeeds, you can then lock the root
user account which will prevent it from being used (you won’t be able to login with it anymore, until you unlock it).
As the sudo user, run:
sudo passwd -dl root
That’ll remove the root
users password and then lock it.