You might have this question at the back of your mind that WTH! is the difference between root and superuser? And how’re their commands different.
User account and sudo?
Here are some tips that will help you out,
So, what happens when you install Ubuntu on your system is that you are prompted to make a user account.
Let’s say you made that account with some username and some password.
What Ubuntu does by default is that it makes your user as the ROOT itself.
Wait, you don’t know what a Guest, User, Root and Superuser are?? :P
Guest: Well. If you are logging in as a guest then you barely have any privileges, you can’t install any software, and your access is also restricted.
User: IF you are the one who installed Ubuntu, then this account is by default gave the administrative privileges by Ubuntu. So, the sudo command which actually can be used by the root user only, but since, by default, you have the administrative privileges you can run the sudo command just by confirming that you are the default user.
God damn it! Just enter your user’s password and the sudo command will work. (if you are the default user only!).
Q. What if you are not the default user?
Ans. Then you can’t run the sudo command until and unless you know the root password!
Q. But I know the default user’s login password, so will it work?
Ans. No. Well, you are not the root, and you don’t have the privileges the administrator has. And that password which you happen to know (the default user login password). It is not the root password.
Q. Then what is the root password and when are you going to tell me what is the difference between superuser and root!!?
Ans. First of all, Calm down, root and superuser are the same. And the root password is deactivated/locked by default, so you have to activate it. Next: you have to set up a root password yourself now, and I am here to tell you how. So relax. Just type (The default user can only do this):
It will prompt you for your user’s password. Enter it.
$sudo passwd root
Enter your required root password and that’s it! You have activated the root password which was locked by default as the default user’s login password was sufficient; now you can log in from other account and get root privileges by providing this password.
Q. What is the difference between the su and the sudo command?
Ans. The su command is like the GOD command; it stands for Switch User.
i.e. su <user name> and BAM!
You can log into any user on your system without knowing his/her’s login password as DUDE!! YOU ARE THE ROOT.
So, just enter your root password and enjoy.
And if you just type su and hit Enter, then you will start operating as the ROOT itself, to get out of root mode type “exit” on your terminal.
Next, is the sudo command which allows the root to execute commands on his account as well as on anyone else’s account (by $ sudo -u username).
So in nutshell, you can be the root in two ways
No 1. if yours is the default account than your login password will work for sudo command.
No2. You know the root password. (Given it is activated, else how can you know it
Feel free to ask any questions!