1. After logging in to ubuntu, use sudo passwd root
the command to initialize/modify the root password. Note: Here you need to ensure that the passwords entered twice are the same to succeed.
ubuntu@gt-ubuntu22-04-cmd-v1-0-32gb-100m:~/ocr$ sudo passwd root
New password:
Retype new password:
passwd: password updated successfully
2. After step (1) is successfully executed, switch su root
from ubuntu
user to root
user, and the Password here needs to be consistent with the one set in (1).
3. After the input is successful, you can see that the user has changed from ubuntu to root
ubuntu@gt-ubuntu22-04-cmd-v1-0-32gb-100m:~/ocr$ su root
Password:
root@gt-ubuntu22-04-cmd-v1-0-32gb-100m:/home/ubuntu/ocr#