Forgot password

Creating a bug report/issue

I have searched the existing open and closed issues

Required Information

from my last successful login as far as I know

Steps to reproduce

  1. Set up homeserver in January
  2. Everything (Pihole, Jellyfin & Ente Fotos) works
  3. Forget about it for some time
  4. Ente Fotos stops working
  5. Me not having the time to fix it
  6. Me finally getting around to fixing it
  7. No longer being able to get into the server because I neither remember the PW nor wrote it down as far as I know.

Expected behaviour

  • Me being able to log in

Actual behaviour

  • Me not being able to login

Extra details

  • I can still connect to the server over WinSCP and the PW is stored somewhere in there
  • However, I can’t just copy the PW from the PW field since WinSCP won’t let me.
  • Guessing the PW was tried but didn’t work.
paste lines of logs or code into such code fences here

Sorry for the rookie mistake, but all my photos are stored somewhere on the server and I don’t want to loose them by resetting it.

Do you have a text editor which can create files with UNIX/LF line ending? If so, you could create a cron job which sets the password via chpasswd, and move that in place via WinSCP.

Notepad++ should work, right?

How do I create a cron job that sets the password via chpasswd and where do I need to place it once it has been created?

Yeah npp is great. Create a file

* * * * * root echo 'root:newpassword' | /usr/sbin/chpasswd

And put it into /etc/cron.d/. It sets the password every minute. So wait a minute, then try to login. And remove the file from /etc/cron.d/ again.

Huh, I did create a file named cron.txt with that code inside using npp. I assumed newpassword is where I should enter the new password so I did. I then placed the file in /etc/cron.d/where I saw two other files (pihole & e2scrub_all). Since both didn’t have the .txt ending I removed it from my cron file. I then waited more than a minute and tried login in with the new password only to be hit with “Permission denied,please try again.” After three tries the connecting gets closed by the server. When I tried connecting WinSCP in another instance I didn’t have to enter a new password. Now it’s possible that the new password is my old one. However that doesn’t explain why I was unable to connect over ssh. The command is just ssh "my_IP" with my_IP being the IP of the server, right? Cause I get prompted to enter a PW, but when I do so it doesn’t work.

Did I make a mistake creating the cron job?

Looks like the change did not happen. The file must not have a file extension, indeed. It must have UNIX (LF) line endings, as shown at the bottom right of npp.

how did you create the file?

I pasted the code into npp, changed the newpassword portion to my new PW and then saved it. npp decided to save it as a .txt file by default and Windows (CF+LF) was selected at the bottom right corner of npp when creating the file.

This time I changed the line ending to UNIX (LF) and selected all types (*.*) while removing any file extension from the name. I decided to just name it cron

Sadly after placing it in the cron.d folder and waiting for more than an minute before deleting the file again nothing still happens.

I also tried saving it as a .d file and then deleting the file extension from the name thinking that since the folder is called that and windows tells me that this file extension is used for the D programming language maybe it will work. Sadly it didn’t.

Hmm, not sure, it works well here. It does not matter what the file is named on Windows, as long as it is finally named correctly on Linux.

If you copy back the file, and open it again with npp, it shows UNIX (LF) file extension?

Ah, try to append an empty line. On Linux, a trailing newline character at the end of a file is common. I probably did this out of habbit.

… yes that is it, without newline:

Nov 03 22:22:01 DietPi cron[315]: (*system*test) RELOAD (/etc/cron.d/test)
Nov 03 22:22:01 DietPi cron[315]: (*system*test) ERROR (Missing newline before EOF, this crontab file will be ignored)

EDIT: And verified again, that files with extension are not recognized at all by cron. You can copy it with .txt extension over, and rename it in WinSCP there.

Hmm, I was able to change the PW but I can still not log in over ssh.

I know for sure that the PW was changed cause I had to input the new PW when trying to connect again with WinSCP. Either the PW that I used for the new PW was indeed the old one or the server didn’t like the fact that ? was in my new PW.

What’s a bit odd when trying to log in over ssh is that I immediately get asked for the PW but never for the username.

The terminal on my host PC where I’m trying to connect to the server show this:

user@userpc: ~$ ssh serverip

user@serverip’s password:

When I enter the PW I get:

Permission denied, please try again.

I have tried entering the PW of the user account on the host PC first, thinking that maybe since it’s a terminal command I get asked for my PW, but that didn’t work either.

Edit: I feel like an idiot. Using ssh root@serverip and then entering the PW did work.

Sorry for wasting your time.

Yes you would need to specify the user. Otherwise your current user is used :slight_smile:

Yeah that makes sense.

Was able to update to a new DietPi version now.

Just to be sure, if apt upgrade doesn’t show any results you don’t have to worry about the MOTD message telling you to upgrade the kernel to fix a security flaw, right?

On a ROCK 5B it should have been updated recently. But just to be sure:

dpkg -l | grep linux-image-
uname -a