I’m new in using Linux terminal, and currently trying to “adduser”. However, the is an error stating “Only root may add a user or group to the system.” I been scratching my head because, by default when installing Linux for the 1st time, the account I’m using should be the root. Isn’t it?
I’m not a big Linux guy, but if you run the command
su root, it should allow you to login with the root password, and run commands as root.
Is this for one of the freeCodeCamp challenges, or just a random LInux question?
Random question. I did read we can create user to sudo group. But before I do just that. Shouldn’t I be using the root by default? It should be either switching to another user, and root (the default?).
When you open a terminal, you usually don’t get access to root, only as normal user. You need to run
adduser as root because
adduser is an administrative command, meaning it can only performed by
root who have all the rights that are necessary to perform administrative tasks.
root as your daily user can be dangerous if you don’t be careful
You are correct. I just read about enable/disable Ubuntu’s Root. If I’m not mistaken now, then my next action would be to enable & set up password for Root, then afterward create a sudo user. Lastly, I’m guessing I would need to switch back between the sudo user to root, to expire root’s password afterward for security reasons. Am I right?
Or, I just do sudo cmd. That work too.
Yup. Enable it, log in as
root (or you can use
sudo) to add new user, and log out from the session by typing
The install process should have had you create a normal user account for yourself so you don’t have to log in as root in the first place. Did it?
If you need to do something as root, which you often will, you should use the
sudo command to do it instead of logging in as root. This will help prevent you from making a mistake you might regret logged in as root. But if you don’t actually have a normal user account yet and the only account you have is root then I guess you have no choice.
The one I’m using is definitely an account created into a sudo group. So, once I created a new user, I’m guessing I can easily switch between the default (using login passsword?) & new user easily?
I could be wrong, but I would like to use my default initial user to create another user, instead of doing it with Root. It said my initial user already part of sudo, but it seem to not though. How do I give this initial user acc with low privileges? Or it already is, but cannot create new user?
Edit: nvm, I think “sudo su” does the job.