0

When I got Linux put onto my personal laptop, I wasn't asked to create a password. Now, whenever my screen goes black, I've got to power it down and restart it in order to get back to the screen I was originally on. How can I create a password so I don't have to do that any longer?

5
  • Do you have root access?
    – Yaron
    Jul 22, 2019 at 15:21
  • Why do you have to power it down?
    – mrfr
    Jul 22, 2019 at 15:23
  • 1
    If you installed Ubuntu, you almost certainly were asked to create a password - although you may have checked the box to not require it for logging in. If you've forgotten it, please see How do I reset a lost administrative password? Jul 22, 2019 at 16:18
  • I didn't install Ubuntu, my computer repair people did it for me at my request. Jul 22, 2019 at 22:55
  • I have to power it down because after I press the power button to bring my computer back online, I don't have anything on my screen except a blank screen with the time and arrows showing. When I power down and back up, I get my icons back. Jul 22, 2019 at 22:57

1 Answer 1

0

Open a terminal window and enter the following command:

whoami

This will return your user name.

Assuming you have root privileges, enter the following command on the terminal:

sudo passwd your_user_name

where your_user_name is your real user name returned by the whoami command. Enter a new password (two times for verification).

Use that password whenever the system prompts you.

Note: The above may not work if sudo prompts for your current password which you do not know.

2
  • passwd should NOT be run with sudo - passwd uses setuid to gain file access. sudo passwd changes root's password.
    – waltinator
    Jul 22, 2019 at 17:20
  • Actually this was a shortcut for sudo -i and then passwd your_user_name. If the first command (sudo -i) prompts for current user's password then this method will not work, since the current password is not known.
    – FedKad
    Jul 22, 2019 at 17:34

Not the answer you're looking for? Browse other questions tagged .