1, sudo command
myRoot @ ubuntu: ~ $ sudo su
Go enter a password to get root privileges
2、sudo passwd root
If we want to have root privileges, to switch to the root user via su, then we must first re-set the root password:
@ Ubuntu myroot: ~ $ sudo passwd root // this way we can set the password for the root user
3, switching to the user
ctrl + d to return to a normal user
root @ ubuntu: / home / myroot # su - myroot returned to normal users