The above question can also be rephrased to, what is the use of the sudo command?man pages for sudo in the bash shell has the following description.sudo, sudoedit - execute a command as another user.This doesn't make any sense to me. Don't I have to be the root user to install from terminal? How does using sudo before the yum install command help?
Why use `sudo yum install ` when I can use `yum install `?
terminal;sudo
sudo command has setuid bit set which means that it is always granted privileges of the user who owns the file (it's always root unless you messed up something yourself). So even if you don't have root privileges, sudo will get them anyway. All programs with setuid are written in especially careful way to prevent vulnerabilities. sudo reads sudoers file to determine if you are allowed to execute selected command as root and if you should be prompted for your password.If you are allowed to run the command and the password is correct (if needed), since sudo has root privileges, all of its children (yum and install scripts maybe) also gain those privileges.It was especially relevant years ago when mainframes were used by big number of people and users with root access wanted to allow some trusted users to execute some often used and not very dangerous commands. Nowadays sudo access is usually granted for all commands (on home desktops at least).