timthe3nchanter
Posts: 7
Joined: Mon Jan 25, 2021 2:33 pm

Ubuntu forgot password for username pi

Fri Jul 23, 2021 6:39 am

I've forgotten a password and the init isn't working and holding shift isn't working nor is pressing esc when its booting up as an alt to holding shift. I've edited the cmdline.txt to add the init line with sudo nano because it was locked and that was the only way to gain access, but to no avail. When I booted it up on the Pi (running ubuntu btw) it booted straight to the login screen. Normally I would just reformat it and start over but I actually had something on there I needed to keep for once. I just haven't used it in a bit. I have ubuntu loaded on a VM so that I can make changes as needed bc windows always wants to format my sd card. I've also scoured my sd card looking for a shadow directory and can't find it anywhere. I'm a little baffled by this and after a couple of times the fog cleared and I checked the box to look for hidden files and folders. It still doesn't show it. I know its supposed to be under /etc/passwd etc/shadow /etc/shadow- but none are there, so my confusion continues.
Screenshot from 2021-07-22 23-32-16.png
etc directory
Screenshot from 2021-07-22 23-32-16.png (237.99 KiB) Viewed 741 times

brainsys
Posts: 173
Joined: Fri Jun 29, 2012 7:16 pm

Re: Ubuntu forgot password for username pi

Fri Jul 23, 2021 3:16 pm

If it's just some files you need - why not plug the card/SSD into the USB slot on another Linux computer and read and copy them - or are you using an encrypted disk?

User avatar
B.Goode
Posts: 12824
Joined: Mon Sep 01, 2014 4:03 pm
Location: UK

Re: Ubuntu forgot password for username pi

Fri Jul 23, 2021 5:47 pm

Are you sure you created a new username 'pi'? Because all the Internet searches I have tried suggest that the default username for an Ubuntu Server installation is ubuntu.


(That doesn't help with your substantive question of how to hack into a system for which you don't have the password, but it might help you gain access by jogging your memory... )

timthe3nchanter
Posts: 7
Joined: Mon Jan 25, 2021 2:33 pm

Re: Ubuntu forgot password for username pi

Sat Jul 24, 2021 6:59 am

thanks for the replies. I'm sorry i didn't get back faster. I did change the user name and I haven't tried pasting in the new directory, do you know what site you saw that on? If I can just get that going I would be back up and running.

User avatar
kerry_s
Posts: 2285
Joined: Thu Jan 30, 2020 7:14 pm

Re: Ubuntu forgot password for username pi

Sat Jul 24, 2021 8:48 am

if you have write access
go into /etc/sudoers.d
open a terminal there
sudo nano nopasswd
put
%pi ALL=(ALL) NOPASSWD: ALL

that should give passwordless access
use
sudo passwd pi
to set a new password after you boot

timthe3nchanter
Posts: 7
Joined: Mon Jan 25, 2021 2:33 pm

Re: Ubuntu forgot password for username pi

Sat Jul 24, 2021 4:42 pm

That didn't work. It still comes up with my main login screen. I tried it a few times and went back to make sure I had everything input correctly.

timthe3nchanter
Posts: 7
Joined: Mon Jan 25, 2021 2:33 pm

Re: Ubuntu forgot password for username pi

Sat Jul 24, 2021 4:45 pm

B.goode, I remember the alphanumeric characters, but the problem is the capitalization and which ones I exchanged for numbers and letters like which A I exchanged for a 4 or T for a 7 that sort of thing.

User avatar
kerry_s
Posts: 2285
Joined: Thu Jan 30, 2020 7:14 pm

Re: Ubuntu forgot password for username pi

Sat Jul 24, 2021 8:04 pm

timthe3nchanter wrote:
Sat Jul 24, 2021 4:42 pm
That didn't work. It still comes up with my main login screen. I tried it a few times and went back to make sure I had everything input correctly.
didn't see you didn't have auto login.
pull it back out, stick it back in your ubuntu
this time were setting up auto login

go to /etc/gdm
open terminal here
sudo nano custom.conf

[daemon]
AutomaticLoginEnable=True
AutomaticLogin=pi

once you get in, open terminal and run the
sudo passwd pi

timthe3nchanter
Posts: 7
Joined: Mon Jan 25, 2021 2:33 pm

Re: Ubuntu forgot password for username pi

Sun Jul 25, 2021 2:43 am

No luck, still went back to my login screen I'm going to boot a new sd card with the same credentials with ubuntu 20.04 desktop same as the other and see if pasting the files in does any good. I'll make a clone 1st so If I jack it up I don't lose everything :-).

User avatar
kerry_s
Posts: 2285
Joined: Thu Jan 30, 2020 7:14 pm

Re: Ubuntu forgot password for username pi

Sun Jul 25, 2021 3:38 am

timthe3nchanter wrote:
Sun Jul 25, 2021 2:43 am
No luck, still went back to my login screen I'm going to boot a new sd card with the same credentials with ubuntu 20.04 desktop same as the other and see if pasting the files in does any good. I'll make a clone 1st so If I jack it up I don't lose everything :-).
maybe a typo in my commands, i was using my tablet & bad memory :lol:

timthe3nchanter
Posts: 7
Joined: Mon Jan 25, 2021 2:33 pm

Re: Ubuntu forgot password for username pi

Sun Jul 25, 2021 8:03 pm

kerry_s wrote:
Sun Jul 25, 2021 3:38 am
timthe3nchanter wrote:
Sun Jul 25, 2021 2:43 am
No luck, still went back to my login screen I'm going to boot a new sd card with the same credentials with ubuntu 20.04 desktop same as the other and see if pasting the files in does any good. I'll make a clone 1st so If I jack it up I don't lose everything :-).
maybe a typo in my commands, i was using my tablet & bad memory :lol:
well its not a problem. I also suffer from CRS.

However, the config file already had the autologin setup for user 1, which was strange i thought, so after I tried your commands I changed that to my username and that didnt work either. Plus there was only a /etc/gdm3 folder, I'm not sure if that is one of those type o's or if thats supposed to be that way or not, I'm new to ubuntu on the pi. I probably should have stuck to a normal password eh? lol

Return to “Ubuntu”