[demo@PHP_DEV_57 ~]$ sudo su
[root@PHP_DEV_57 www]#
Why I can switch to root by simply sudo su
, what's the difference between sudo and su?
susudo
[demo@PHP_DEV_57 ~]$ sudo su
[root@PHP_DEV_57 www]#
Why I can switch to root by simply sudo su
, what's the difference between sudo and su?
Best Answer
sudo
allows one user to run commands with the permissions of another user. By default, on most systems, some users are allowed to use sudo to run commands as root.su
requires a user's password to log in as that user, unless it is run by root. Thus,sudo su
allows you to pretend to be root in order to log in as root without root's password.PS:
sudo -i
is recommended oversudo su -
which is recommended oversudo su
for most everyday purposes.