Server credential reset utility for Linux-based platforms

Yes, I changed my password & the server was restarted.

First off, thank you for the script that will fix the issue for those daunting individuals who feel up to the challenge. However, I have to ask about those who lack the technical know-how to fix this issue immediately on their own.

Obviously, this script is meant for those who need their server restored immediately and cannot wait for the code to be OFFICIALLY and PROPERLY PATCHED. So that begs the question: What is the timeline for WHEN the Plex DEVS will be FIXING the problem from the Code/Dev side and making that update available to the public?

Your kill -11 $(pidof ‘Plex Media Server’) suggestion did indeed put a stake through the heart of the 3 hung server processes, so that was great.

I then proceeded to run ./UserCredentialReset.sh again and this time with success. After pasting in my claim token, the process completed without errors. Excitement levels rising, only then to be disappointed once more!

Then I went into QTS File Station and had a little look at Preferences.xml and could see that it had been populated (towards the end of the string of text) with entries against PlexOnlineToken= PlexOnlineUsername= PlexOnlineMail= BUT earlier on in the string of text, those same 3 fields of data also appeared with no entries beside them. Significant?

Next, in the QNAP app centre, I restarted Plex.

Then, I went to Chrome on my laptop and opened an Incognito window and entered http://192.168.etc.etc:32400/web and Plex would not load. All I got was a “This site cannot be reached” type error. I then tried this on an incognito tab on my phone. I tried it with an SSH tunnel to the QNAP off and on. I did a reboot of the QNAP and still no joy. I also tried with my Kaspersky AntiVirus on and with it paused.

I feel like layers of an onion are being peeled off and inside there somewhere is a working PMS again! But I’ve still not quite got to the centre of it. Any other suggestions for me? (And thanks so much for your work and willingness to help).

The reward for great work is… More work -. -

If those fields are blank, then it did not claim. I check for that too.

if any one is blank, i print out a warning and fail out.

# Make certain we got valid data
if [ "$Username" = "" ] || \
   [ "$Email"    = "" ] || \
   [ "$Token"    = "" ]; then

  echo Incomplete credentials from Plex.tv
  echo "  Username: '$Username'"
  echo "  Email:    '$Email'"
  echo "  Token:    '$Token'"
  echo ""
  echo "Cannot continue"
  echo ""
  echo "Server credentials are cleared but server has not been reclaimed.  Claim manually"
  exit 1

fi

I just ran it here… I cannot replicate your situation… I’ve sent you a PM.

That’s strange as I definitely got a success message but it did seem odd to me that I essentially have duplicates of those 3 pieces of data in the preferences.xml file, one set with no info beside and one set with seemingly correct entries beside.

Is there a way for me to message you the contents of preferences.xml to review to see what you think?

Or can you think of something else I can do with that file to get it into a more normal state?

I just pushed a change which clears out all instances of what it’s looking for
(Username, Token, Mail, Home, SecureConnections).

Now it will clear up the screwy ones you have at the front, and the new valid ones at the end, before it writes new ones.

PMS will fault if it sees a duplicated preference name in Preferences.xml

1 Like

Have logged off and headed to bed! Have just seen your pm and will attend to that in the morning. Many thanks.

I am looking at my code. As long as those 3 names have " (something=") it will get them… If not, MANUAL edit required,

Sorry

So I redownload the .tar file at post number 1 in this thread and that will be the new version you have just pushed? I put that on my qnap in place of the earlier version, then extract and run it as I did before? If so, I’ll get onto that in the morning.

@E_J_2022

Please read your PM when you get this.

As you were so kind as to offer support late into the evening, I wanted to act on that straight away so here I am now, at 1.22am in Alberta WITH A WORKING PMS! THANK YOU…THANK YOU…THANK YOU!!!

Out of interest, I downloaded the new version of the .tar file and replaced the one I had on my PlexData share with this new version. I ran it successfully. However, upon inspecting Preferences.xml, the three rogue (empty) entries were still there.

Then I remembered something. It was me that emptied out the entries against those fields, maybe 2 days ago, when I was trying to follow one of the million other posts that I have read about this subject lately! I think I caused my own problem there. Once I remembered that, I replaced Preferences.xml with the original copy of the file, which thankfully I had kept a copy of. Then I ran your script again and everything just worked great. Seconds later, I had a fully working PMS.

Whilst being as mad as hell at Plex for having a disastrous password reset process that has cost me 3 days, I see two positives…

  • I learned a little something about SSH that I didn’t know before
  • I learned that there are some truly exceptional and inspirational people out there who are willing to help people like me who have very little knowledge of such things. Thank you so much ChuckPa.
4 Likes

Thank you for the Reset-Tool and explaining the process. I did (hopefully) the whole thing: signed out and stopped the Plex package on the Syno NAS-box, entered and ran UserCredentialReset.sh via ssh - a first to me, but after some initial problems it worked like you described, ending with username/email prompt.
However, after that, I could not restart the Plex package.
Any hints on this one?
Do I have to reinstall (and loose my library)?

Only after posting this I saw [E_J_2022]'s post which gave me to think because I did the same thing (fiddling with the preferences before trying the reset tool). So I compared the original and the current preferences file and found one difference: the token. I entered the token into the copy of the original preference file and made it the valid one. Result: not only could I start the Plex package again, but was also back online with my library! Hurray and thanks for your post! :sweat_smile:

@ChuckPa
May I ask if this script/tool can be included in the pms package in the future?
I think it is very powerful and can help in many situations as a first-aid tool, in case having problems accessing your server due to account changes?

@Mitzsch

I’ll discuss it with the teams (QA & Engineering) if that’s what everyone here wants.

I will be asked “How many people want it?”. If I say " I know at least one person wants it", I will get the evil eye.

I’m also working on a DB repair tool. That has a wide applicability and they’ve already said they’ll definitely review that tool for general inclusion in all distributions

2 Likes

@ChuckPa With the latest version of your script it has fixed my issue. The server started working again immediately. Thanks for the help! :smiley:

Hi ChuckPA,

Above worked for me as well. Thank you. I am now stuck on the Turbocharge Your Metadata screen, but have added a reply to a topic with that question for some help.

Regarding this, one suggestion: add the above instruction to the “Troubleshooting Plex Media Server Claiming” section of What if Your Plex Account Requires a Password Reset? | Plex Support (the link included in the mail where we were requested to reset our passwords).

I’ve been trying with SSH (and I’m a noobie like EXPTA), so finding this earlier would have saved me a few hours.

Thanks,

Pieter

@pieter.offers

This is PMS offering to upgrade your agents / scanners .

Apparently the version you came from was old enough to trigger it.

If your naming is per standard, go ahead and let it make the changes.
If not, skip it for now and then upgrade each library section manually.

Be advised

It is wanting to upgrade because the old Python -based agents are deprecated and Engineering will soon be removing all support for it.

PMS can see you’re using the old agent and wants to upgrade you to the new agent before you lose all matching capability

I finally got Putty to log into my server, where do I go next?
I put the file in the Home directory on datavol1 of my server.
How do I navigate there and run the file usercredentialreset.tar ?

where do I get my token?

Chris