Hi,
I am new to linux and my profession is not computer sciences, but i am learning.
I do understand a bit about user accounts in Linux: root and users etc.
I would like to change users names for securing login. So how do i do it correctly? Found some information but non is complete. What i would like to do:
You cannot and must not remove the root user as it is essential part of any Linux system. And on DietPi you should not remove the dietpi user, as it is used by some software installs, but we’re going to remove it in a future release. But what you can do is lock those (disable their password so that it isn’t possible to login):
usermod -L root
usermod -L dietpi
But before doing so, create an own user account that you want to use for login, like:
This creates a user named “eglider86” with its home directory /home/eglider86, including the default files added from /etc/skel and bash as login shell. The second command is to assign a password. Without a root user account, you may also allow this new user to run commands with root privileges via sudo:
Thank you so much. Real education here!
Yes i have realized the dietpi account is needed, since after deleting it i was not able to add softwares…
Ok. I follow your points.
Thanks again
aha! none of the googling i did while trying to setup a new user included this part about making /etc/skel. had i not found this post i would still be banging my head on this topic.
Update…
The usermod command did not add the user to the sudo group for me. This worked. Hopefully this will help someone else who ran into the same thing as me:
Hmm usermod -aG sudo username definitely adds it to the group, as long as no error message is returned. For it to have the intended result, there is a line in /etc/sudoers required (and should be present by default):
%sudo ALL=(ALL:ALL) ALL
This is basically the same syntax you use to grant an individual user sudo permissions, but with the % is applies to the respective group.
However, creating an own config file is probably the cleanest and definitely the most compatible solution anyway, as not all distros come with the sudo group or the above entry in the default config file.