There are different types of users in Linux.
- Root user
- Super user
- Normal user
Root user is like the Administrator account in windows. Root user has the highest privileges. So, if you switch to root , you can do anything inside of the operating system. Because of that it’s need to use that account very carefully.
Normal users are the account that you use regularly. I created a student named user account in the article which i installed CentOS-7 in VMware. A regular user has no previledges for changing system files and root managed files. But some system files can be viewed. Regular user access all the files in that user’s domain.
A super user is who can gain root power, which mean a super user can switch and gain root access on requirement.
Eg: A normal user can’t install applications in Linux. But, a super user can do that by switching to root.
Only root user can make a normal user as a super user.
Additionally, we will discuss the helpful Linux command for switching in between users.
- su <user name> : switch user
- su – : switch user to root
- su root : same as above
- sudo su : switch to root user without password ( this is for superusers only )
What is the difference in using su <username> and su – <username> ?
It is like this. In Linux operating system, there are environmental variables. They are like unique things for users. Something like a home directory, host name, user name like that. So, if we switch user with “su – <username>” command, it will take us to other users account. Environmental variables will be changed accordingly. But if we use the command “su <username>“, it will not take us to next users account. It will not change the environmental variables accordingly. Because we are accessing the other users files being inside of our account. But su – <username> will change the user account with it’s environmental variables as well.