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?
-
Do you have root access?– YaronJul 22, 2019 at 15:21
-
Why do you have to power it down?– mrfrJul 22, 2019 at 15:23
-
1If 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?– steeldriverJul 22, 2019 at 16:18
-
I didn't install Ubuntu, my computer repair people did it for me at my request.– Glenn SellersJul 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.– Glenn SellersJul 22, 2019 at 22:57
1 Answer
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.
-
passwd
should NOT be run withsudo
-passwd
usessetuid
to gain file access.sudo passwd
changesroot
's password. Jul 22, 2019 at 17:20 -
Actually this was a shortcut for
sudo -i
and thenpasswd 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.– FedKadJul 22, 2019 at 17:34