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,
-
Removes the existing Username, Mail, Token, and PlexHome preference values from an existing Preferences.xml file leaving the server now suitable for claiming.
-
Reclaims the server via a user-entered “Plex Claim Token” (obtained by visiting https://plex.tv/claim)
Currently supported platforms (more can be added)
- Linux (workstation & server)
- Synology (DSM 6 and DSM 7)
- QNAP (QTS and QuTS)
- Netgear ReadyNAS
- ASUSTOR
- Western Digital ( OS 5 – PR,DL, and Ultra - at this point
(recommend usingPublic
shared folder) - Selected Docker containers
- Manual Path specification (which includes containers and custom) (See below)
How to use this tool.
-
Stop Plex
-
Place the tar file on the host and extract its contents.
tar xf ./UserCredentialReset.tar
. You will see fileUserCredentialReset.sh
-
Open a terminal window or SSH session to the host.
-
If needed, using
sudo
, elevate your command line shell toroot
(admin
on some machines -
Invoke the utility
./UserCredentialReset.sh
-
It will confirm the host platform type (so it knows what to do)
-
It will confirm you have sufficient user privilege and PMS is stopped
-
It will then prompt for a “Plex Claim Token”.
-
Open a browser tab to: https://plex.tv/claim
-
COPY the given token
-
WITHIN 4 Minutes, PASTE the token on the utility’s command line
(The token expires so we need be quick) -
Hit Enter and it will immediately complete the task.
-
When complete, It will verify all your credentials are valid and then update Preferences.xml for you
-
It will print out your Plex username and email used in case you have multiple accounts.
-
Utility then exits.
-
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
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.
- You can run the job as a scheduled task
- 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? )
(rev: 2022-08-31 19:30 UTC
- Support REMOTE servers
- Support all WD OS5 boxes
- Remove “access via LAN IP” requirement.