In linux, the root user is equivalent to the Administrator user on Windows. When you run the linux system administration especially in the critical systems, by allowing staff to use root all the time to perform administration and maintenance that will risk your organization and will vulnerable to security incident.
For example, if there is software in a linux system that has a security hole and you run it as root, a malicious file or script that is accidentally downloaded will be able to write to all the files on your system. This is the main idea why sudo is introduce in linux, for security and to protect the system. With normal user, you can’t modify system files without gaining root permissions. When you log in as your own user account or a regular user, the programs you run cannot write to other systems, they can only write to your home folder. Only use sudo whenever a user tries to install, remove or change software only. This helps keep your computer secure from unnecessary security incident.
The sudo command is used to grant such permissions to specific commands that the user wants to execute after the user enters a user password to give system based permissions. While this can still cause problems, it’s much better than your entire system being compromised.
Sudo helps enforce best practices in linux system administration, running only commands that need to be run as root without leaving you at a root shell where you may stay logged in or run other applications as root.
Sudo stands for either “substitute user do” or “super user do” and it allows you to upgrade your current user account to have root privileges temporarily. This is different from “su” which is not temporary. With “sudo,” you continue to use your user account, but with root privilege, whereas in “su,” you are actually logged into the root account.
Example : Use sudo command to gain root privilege to restart the apache httpd service :
# sudo systemctl restart httpd