Server credential reset utility for Linux-based platforms

Plex Media Server User Credential Reset Utility

In light of the security event plaguing everyone, a ‘quick & dirty’ tool was crafted.

It’s a little rough around the edges but gets the job done.
It’s been evolving due to the need.

This tool,

  1. Removes the existing Username, Mail, Token, and PlexHome preference values from an existing Preferences.xml file leaving the server now suitable for claiming.

  2. Reclaims the server via a user-entered “Plex Claim Token” (obtained by visiting https://plex.tv/claim)

Currently supported platforms (more can be added)

  1. Linux (workstation & server)
  2. Synology (DSM 6 and DSM 7)
  3. QNAP (QTS and QuTS)
  4. Netgear ReadyNAS
  5. ASUSTOR
  6. Western Digital ( OS 5 – PR,DL, and Ultra - at this point
    (recommend using Public shared folder)
  7. Selected Docker containers
  8. Manual Path specification (which includes containers and custom) (See below)

How to use this tool.

  1. Stop Plex

  2. Place the tar file on the host and extract its contents. tar xf ./UserCredentialReset.tar. You will see file UserCredentialReset.sh

  3. Open a terminal window or SSH session to the host.

  4. If needed, using sudo, elevate your command line shell to root (admin on some machines

  5. Invoke the utility ./UserCredentialReset.sh

  6. It will confirm the host platform type (so it knows what to do)

  7. It will confirm you have sufficient user privilege and PMS is stopped

  8. It will then prompt for a “Plex Claim Token”.

  9. Open a browser tab to: https://plex.tv/claim

  10. COPY the given token

  11. WITHIN 4 Minutes, PASTE the token on the utility’s command line
    (The token expires so we need be quick)

  12. Hit Enter and it will immediately complete the task.

  13. When complete, It will verify all your credentials are valid and then update Preferences.xml for you

  14. It will print out your Plex username and email used in case you have multiple accounts.

  15. Utility then exits.

  16. Start PMS. It will be back to normal.

Conclusion

When you start PMS, it will already be claimed for you.
PMS will have no idea what happened while it was shut down :smiling_imp:

PLEASE don’t hesitate to ask if questions or issues.

How it looks in use

[~] # ./UserCredentialReset.sh            
 
          Plex Media Server user credential reset and reclaim tool (QNAP)
 
This utility will reset the server's credentials.  It will then reclaim the server for you via a Plex Claim tokem from Plex.tv
 
Please enter Plex Claim Token copied from http://plex.tv/claim : claim-G7Y7E4EqZkciJiRApeuL
Clearing Preferences.xml
Preferences.xml cleared
Getting new credentials from Plex.tv
Claim completed without errors.
 Username: ChuckPA
 Email:    ChuckIsCrazy@loonies.com
 
[~] #

Special consideration for NAS users without SSH capability.

  1. You can run the job as a scheduled task
  2. Instead of typing the Claim Token interactively, you can enter it on the command line.

Please observe:

[~] # ./UserCredentialReset.sh claim-GRiErLwrCnLY6tmJqFna
 
          Plex Media Server user credential reset and reclaim tool (QNAP)
 
This utility will reset the server's credentials.  It will then reclaim the server for you via a Plex Claim tokem from Plex.tv
 
Using claim token:  'claim-GRiErLwrCnLY6tmJqFna'
Clearing Preferences.xml
Preferences.xml cleared
Getting new credentials from Plex.tv
Claim completed without errors.
 Username: ChuckPA
 Email:    ChuckIsCrazy@loonies.com
 
[~] # 

Manual path: -p mode)

The utility now supports various installations (Docker, etc) by accepting the path to Preferences.xml directly on the command line.

This capability, enabled with the -p option on the command line,

  • Command line syntax:
./UserCredentialReset.sh  -p "/path/to/external/Preferences.xml" optional-claim-token-here

If -p (preferences path) is seen as the first command line argument,
it will expect the next argument to be the full path to Preferences.xml

It will verify the given file name exists and minimally contains some information found in a Preferences.xml file

It will continue to use this location and perform a normal claim action and store all output in the given pathname.

Given how containers work, it is not possible to validate anything further.
Proper use is the user’s responsibility.

Supplemental:

You may also invoke the script using sudo ./UserCredentialReset.sh. Linux should know to use /bin/sh as that’s in the magic bytes.

Also, sudo sh ./UserCredentialReset.sh is perfectly valid

( Isn’t Linux great? :smiling_face: )

(rev: 2022-08-31 19:30 UTC

  1. Support REMOTE servers
  2. Support all WD OS5 boxes
  3. Remove “access via LAN IP” requirement.

Please see the README.md f

ReadMe

UserCredentialReset.tar

15 Likes
Server reports "Not authorized: You do not have access to this server" after password reset
[Solved] Synology DS918+ / Unable to reconnect local NAS after changing password
Cannot access QNAP Plex Since resetting password
How do you add a server and/or reconnect a server to the web app?
Problems reclaiming PMS on Synology after password reset
Asustor 6404 I can't link the Plex server to the account
Plex Media Server on WD PR4100 goes offline
If you lost access after password reset, need to "reclaim" server
Plex Media Server on Snap NAS is completely unfindable after password reset
Important notice of a potential data breach 24th of August 2022
Since password reset I can't see my server any more - or it says I'm not authorized
Plex no longer connects to my Plex Media Server on Synology NAS!
Cannot access QNAP Plex Since resetting password
Asustor Plex no longer seen as a server?
Plex Apps or Clients can no longer see local server - when when connecting web on local IP for serv
Can't add server/library after resetting password
Filled with rage
Media server install on loop! I have media server installed, but PLEX keep asking to install! HELP
Don't see Server option on WD NAS
There was a problem claiming this server on setup
Please Help... Unable to access my Plex Media Server after data breach password change!
Server inaccessible and libraries deleted after logging server back in
Synology NAS Server unreachable after a password change in plex
Lost access to server settings
Password change has killed my PMS on WD PR4100
I Changed the password in Plex as requested by Plex. Now I can’t access My Cloud Home from Plex
Action required: Important notice of a potential data breach
After PW change, server claimed, can access locally, but Plex.tv says "unable to connect securely"
Server reports "Not authorized: You do not have access to this server" after password reset
Trying to re-link my WD MYCLOUD HOME following resetting my PLEX password
No more Server since password changing
Password reset due to security breach: my LAN Plex Server keeps telling me to install Plex Server
Reset PW after data breach, now can't see my server
Action required: Important notice of a potential data breach
Plex Server Vanished - Unable to Add Media
Reset password and logged off devices now can't get back into my plex server to register
Plex Server says "Not Authorized"
Library access lost
Can't See Plex Media Server Settings via Local Plex Web App
Paswoord change with a google inlog account
Unable to connect after password change
Asustor - launches Plex Player NOT Media Server
Qnap Server currently unavailable after update/password change
Reset pword. Server on TrueNas is now unreachable, no option to reclaim. HELP!
Running Plex on Synology - No menu option for Live TV & DVR
Changed admin password and now admin doesn't have access to the local media server
Synology DS1621+ Reset Password, Tried Uninstalling Plex Media Server, Now Can't Use Claim Code
Can't find my server after password reset
Error Acquiring Certificate after Password Reset
Problem after password reset
Restore from scheduled backups
Plex account has email that I no longer have access to
Can’t connect to Plex Server after password change
Can't find my server after password reset
Unable to claim PMS after password reset
Passwort Zurücksetzen
(Re-)Claiming a QNAP Plex Media Server
Locked out ... re-claim funktioniert nicht
Plex Library and settings gone after password change
PMS Already Installed, but asking to install it?
Cannot reclaim Synology PMS Server
Password Reset = PMS Destroyed (ReadyNAS) & SO MUCH PROFANITY
PlexMediaServer - Collection non accessible avec fresh install
Changed Password And All Worked, Now Everything Is "Unavailable"
Cannot claim plex server on Mac or QNAP and boy have I tried
PLEX zeigt bei + Deine Medien - Holen sie sich den Medien Server
Can’t claim server
Media not showing up, saying server unavailable despite linking
Media Missing
Unable to access server after password reset
Important Notice of Security Incident
New install: Not authorized - You do not have access to this server
Cannot access server
Plex server cannot connect
Login is not working
Login is not working
WD EX2 ULTRA Wont Find server after password reset
Filled with rage

Thanks! That worked for me after enabling SSH. One change to the procedure I made for my QNAP NAS was the command to issue was " sudo bash ./UserCredentialReset.sh"

This is GENIUS! Thank you for posting it. It did the job perfectly!

1 Like

Great work @ChuckPa - perhaps all our back and forth wasn’t in vain after all. Prevention better than cure now - you and @dane22 can actually do your day job again :stuck_out_tongue:

I am glad this works for you.

It’s a collection of things I’ve assembled from all my packaging and a new utility I am about to publish

3 Likes

How do you run it when using docker (Docker Hub)?

I can connect inside the container with bash but when trying to run the script it complains that PMS is running. Killing PMS with the pid does nothing since it automatically restarts.

I have a few synology nas’s some with dsm6 others withdsm7. In step 1 it says place the tar file… etc. where exactly are we placing the file if we haven’t started a ssh session yet.

You can place the tar file anywhere you want – including in the home directory you land in.

It doesn’t matter where the script itself is.

Once it detects the host type, it sets itself up and points directly at the data.

The most important thing to do is run with sudo privileges

Thanks @ChuckPa - I was really hopeful this would be the fix to my DSM 6 woes. I had followed a bunch of other attempts to reclaim my server but to no avail.

Having run the script, I got all the right signals coming from the script: saying everything had worked. However I am now unable to start the Plex server.

I am getting this error in the startup crash logs

Aug 26, 2022 12:00:25: Failed to initialize logging: Empty or non-existant file.

Any advice? Thanks

There is also another thread where is posted a Bighammer.sh , which should I be using? I am a linux novice like many I suspect so some very clear instructs with what to type would be very helpful to avert problems. In my case I tried both Bighammer.sh and the script mentioned on this thread and after copying the script and extracting to share/Public on the QNAP , logging in via SSH as admin I get file cannot be found??? Help please!

@rogc

Please point me to it?

I will edit and redirect here.
This thread is the finished script

@ChuckPa Once again you save my souse. The script worked 100%.

I just want to note that it could have been a bit easier to wget the script into the Linux box.
The short-link attached to the post throws back a 404 in ubuntu, when I use wget.

  1. But it works to click on it from the browser.
  2. Open with 7zip and open UserCredentialReset.sh with notepad.
  3. From there I copied the content.
  4. created a blank script “sudo nano UserCredentialReset.sh”
  5. Past in the content from clipboard.
  6. sudo chmod +x UserCredentialReset.sh
  7. sudo ./UserCredentialReset.sh

@vivid.water

What are you doing running NotePad on Linux? :scream: lol

The forum is set to click-download and get the right file name.
“wget” , when you are already here in the GUI ?? why?

The contents of the tar ball is already chmod 775

[chuck@lizum biggerhammer.788]$ tar tvf UserCredentialReset.tar 
-rwxrwxr-x root/root      7301 2022-08-26 08:55 ./UserCredentialReset.sh
[chuck@lizum biggerhammer.789]$
1 Like

Is there anything else around that error ?
I need more context.

Initial thought is something is wrong with the permissions in the Plex shared folder.

I’m having a problem with Putty. Got the Tar file extracted on my share folder.
Then when i run the sudo command I get No such file or directory even though I can clearly see the UserCredentialReset.sh file when i browse using WinSCP. Any help?

Genius, thanks for posting. it worked like a dream on my Synology DSM7.

Does this work for TrueNas users?

@adammallard23_gmail_com

I don’t currently have any “personality identification” for TrueNAS.

If you know the pathnames, I’ll work with you to quickly add the support for it.
Otherwise, I’ll have to make some time and setup a TrueNAS VM and do the exploration.

Which NAS are you using and where did you put the tar file?

I can give you customize instructions once I know those two pieces.