ubuntu initialize/modify root password

1. After logging in to ubuntu, use sudo passwd rootthe 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 rootfrom ubuntuuser to rootuser, 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#

insert image description here

Guess you like

Origin blog.csdn.net/qq_40600379/article/details/131950884