lichengbei
2019-12-21
Ubuntu初始安裝沒有給root用戶設置密碼,使用su命令切換到root就會拋出 su : Authentication failure 異常。
解決辦法就是給root用戶設置一個初始密碼,操作如下:
lichengbei@ubuntu1804:~$ sudo passwd root
[sudo] password for lichengbei: {1234.qwer}
Enter new UNIX password: {1234.qwer}
Retype new UNIX password: {1234.qwer}
passwd: password updated successfully
lichengbei@ubuntu1804:~$ su
Password: {1234.qwer}
root@ubuntu1804:~#
說明一下,命令行輸入內容前的提示符$代表一般用戶,#代表root用戶, exit 命令可退出root並返回普通用戶。