Some users are able to run commands as another user.
sudo
Usually the sudo command is used to execute a command using root privileges.
Only elevate your privileges to root when needed.
sudocat/etc/passwd# Runs the cat command as rootsudo-uuser2cat/home/user2/test.txt# Runs the cat command as "user2" user
su
su - change user
suuser2su--helpUsage:su [options] [-] [<user> [<argument>...]]ChangetheeffectiveuserIDandgroupIDtothatof<user>.Amere-implies-l.If<user>isnotgiven,rootisassumed.Options:-m,-p,--preserve-environmentdonotresetenvironmentvariables-w,--whitelist-environment<list>don't reset specified variables -g, --group <group> specify the primary group -G, --supp-group <group> specify a supplemental group -, -l, --login make the shell a login shell -c, --command <command> pass a single command to the shell with -c --session-command <command> pass a single command to the shell with -c and do not create a new session -f, --fast pass -f to the shell (for csh or tcsh) -s, --shell <shell> run <shell> if /etc/shells allows it -P, --pty create a new pseudo-terminal -h, --help display this help -V, --version display version
passwd
passwd - change user password
passwd# Change current user's passwordsudopasswduser2# Change another user's password using an elevated user