On a multi-user system, what protects against any user accessing any other users files via root? As context, the question is based on my understanding as follows:
There are two commands related to root privileges, sudo
and su
. With sudo
, you don't become another user (including root). sudo
has a pre-defined list of approved commands that it executes on your behalf. Since you are not becoming root or another user, you just authenticate yourself with your own password.
With su
, you actually become root or another user. If you want to become user Bob, you need Bob's password. To become root, you need the root password (which would be defined on a multi-user system).
ref's: howtogeek.com:
su
switches you to the root user account and requires the root account’s password.sudo
runs a single command with root privileges – it doesn’t switch to the root user.
and
If you execute the su bob command, you’ll be prompted to enter Bob’s password and the shell will switch to Bob’s user account; Similar description at computerhope.com
‘sudo‘ is a root binary setuid, which executes root commands on behalf of authorized users
If you become root, you have access to everything. Anyone not authorized to access another user's account would not be given the root password and would not have sudo
definitions allowing it.
This all makes sense until you look at something like this link, which is a tutorial for using sudo -V
and then sudo su -
to become root using only your own password.
If any user can become root without the root password, what mechanism protects user files from unauthorized access?