Friday, April 19, 2024
59
rated 0 times [  59] [ 0]  / answers: 1 / hits: 545973  / 2 Years ago, tue, september 27, 2022, 3:03:13

Possible Duplicate:

How to know my root password?




I'd like to define a password for root so that I can use su directly, without having to prepend it with sudo. And because I'd like to log in as root as well.


So how to set a password for the root user?


More From » command-line

 Answers
5

Warning: Directly logging in as root is like playing with fire, because one little typo is enough to lose critical data or make your system unbootable. Note that desktop environments will also function incorrectly if you login to them as root.


See these questions for the reasons behind why sudo is preferred and why root-login is disabled by default:



  1. What are the benefits of sudo over su?

  2. Why is there no option to login as root?



You may have noticed that you can’t log in as root on Ubuntu, this is because root doesn’t actually have a password set.


Enter the following command:


sudo passwd

You will be prompted for your current user's password, followed by the password you want to set for root. The messages prompted should be similar to the following:


[sudo] password for <username>: <Type your user password and press return>
Type new UNIX password: <Type the root password you want>
Retype new UNIX password: <Retype the root password you chose in the previous prompt>

The following message will appear after that:


passwd: password updated successfully

If the above message showed up on your terminal, you can now enter as root from your current user entering the following command:


su

And you will be prompted for the root password you've set. That's it!


[#37330] Wednesday, September 28, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
errettas

Total Points: 160
Total Questions: 118
Total Answers: 91

Location: Laos
Member since Fri, Sep 11, 2020
4 Years ago
;