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.
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.
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.
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.
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?