Server credential reset utility for Linux-based platforms

Logs.zip (4.4 MB)

looks like this could solve my problem. Any idea on how I can remote upload the script to my Ubuntu server from a terminal in Mac? Because that’s what I’d need to do…

@LorenzL have you tried croc before? its such a joy to use

No, but will give it a try, thanks!

Thank you, @ChuckPa for clearly laying out the steps required to get my server claimed.

This post is exactly what I needed. Thank you!!!

used @nebbles suggestion and was able to move the script and execute it. pasted the code from claim as instructed - everything ran without errors. However! I then restarted plexmediaserver and still it won’t let me access my media (or let me add any media) :frowning:
What else can I do?

Ok, I can add libraries again. Now I have the issue that it sees my external HD that’s connected, but it doesn’t scan the files on it. I assume the new plex install doesn’t have the rights… I give up for now…

Had to chown -R add plex as user to my media folder.

Piscine is the pool. It’s an array of hdd.

iocage is the dataset. It’s a filesystem. You can create files, folders, permissions… The iocage dataset is automaticly created for the jails.

jails is the jail. Jails are like containers. So the jails folder is the folder containing the plugin or manualy created jails (as in my case).

Thanks for the tool however it seems to struggle a bit with a present override.conf.

Everytime I trying to run it I got this:

root@MediaNAS:~# ./ResetCredentials.sh
Given application support directory override specified does not exist: '(echo Environment="PLEX_MEDIA_SERVER_APPLICATION_SUPPORT_DIR=/mnt/appdata1/Library/Application Support" | sed -e 's/[^.]*SUPPORT_DIR=//' | tr -d ")' Ignoring.

          Plex Media Server user credential reset and reclaim tool (Ubuntu 22.04.1 LTS)

This utility will reset the server's credentials.  It will then reclaim the server for you via a Plex Claim tokem from Plex.tv

ERROR:  Cannot find Preferences file at '/var/lib/plexmediaserver/Library/Application Support/Plex Media Server/Preferences.xml'. Exiting

Note in the script, there is a \" after the tr -d \" - in the console output it’s missing (and also the small typo on token :wink: )

The shown /mnt/appdata1/Library/Application Support path is the correct one for my system.

I managed to get it working by manually editing the AppSuppDir= definition.

Here’s my Logs
Logs.tar.gz (2.3 MB)

Thanks for this but as I said before I cant get the script to be seen no matter where I put it on the QNAP. I’ve tried under various shared folders. Here is a screenshot. As you can see nothing happens when I try and unpack. This is on a QNAP TS-453A
Thanks for your continued support

Update: I see what I missed now getting new credentials

@Mitzsch

Please show me where I fat-fingered on the override edit ?

I caught myself having made a booboo. (used bash variable editing in bourne shell)
thought I fixed it correctly.

:see_no_evil: I found it… Missed a $

NewSuppDir="$(echo $NewSuppDir | sed -e 's/[^.]*SUPPORT_DIR=//' | tr -d \")"

The typo is only in the word token - the output of the script says tokem - :see_no_evil:

The other thing with the override.conf I have no idea. I just noticed that the \ was missing in the console’s output.

Oh awesome, I will try that in a minute :wink:

#Edit: Works!!! Thanks!!

override.conf fixed.

I like Tokems :stuck_out_tongue:

LOLOL

tarball updated: 15:15 UTC

(getting worn down here. I’m making mistakes. not good)

2 Likes

Folks:

When trying to copy the tar file to the NAS:

  1. If you use WinSCP: Put the file in /share/Public
  2. If you are using a Linux/MacOS machine:

(showing you my machine)

[chuck@lizum bighammer.850]$ scp UserCredentialReset.tar admin@ts128:/share/Public
UserCredentialReset.tar                                                                       100%   10KB   6.2MB/s   00:00    
[chuck@lizum bighammer.851]$ ssh admin@ts128
--- now on the TS128 command line ----
[~] # cd /share/Public
[/share/Public] # ls -la User*
-rw-r--r-- 1 admin administrators 10240 2022-08-27 11:34 UserCredentialReset.tar
[/share/Public] # tar xf UserCredentialReset.tar 
[/share/Public] # ./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 token from Plex.tv
 
Please enter Plex Claim Token copied from http://plex.tv/claim :

So everything seemed to work OK I got the message claim completed without errors but noticed it only came back with username not email? Then tried to restart Plex and still no server visible.
Any suggestions?

@rogc

Let me make sure I didn’t break anything in the fixes I needed last night.

[/share/Public] # ./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 token from Plex.tv
 
Please enter Plex Claim Token copied from http://plex.tv/claim : claim-_9qszc5esy5Wgrr22ECC
Clearing Preferences.xml
Preferences.xml cleared
Getting new credentials from Plex.tv
Claim completed without errors.
 Username: ChuckPA
 Email:    Chuckxxxxxxxx@xxxxxxxxx.xxx 
[/share/Public] #

Show me what you’re getting. It doesn’t make ANY sense to not get email – Plex requires email addresses.

@fnkstr

Found your problem…

Your LAN subnet is NOT RFC-1918 compliant.

Aug 27, 2022 07:55:28.942 [0xb23b6d44] WARN - NetworkServiceBrowser: Error sending out discover packet from 10.255.0.1 to 239.255.255.250: Operation not permitted
Aug 27, 2022 07:55:29.171 [0xb1d41d44] WARN - NetworkServiceBrowser: Error sending out discover packet from 10.255.0.1 to 10.255.255.255: Operation not permitted
Aug 27, 2022 07:55:29.171 [0xb23b6d44] WARN - NetworkServiceBrowser: Error sending out discover packet from 10.255.0.1 to 10.255.255.255: Operation not permitted
Aug 27, 2022 07:55:34.172 [0xb1d41d44] WARN - NetworkServiceBrowser: Error sending out discover packet from 10.255.0.1 to 10.255.255.255: Operation not permitted
Aug 27, 2022 07:55:34.172 [0xb23b6d44] WARN - NetworkServiceBrowser: Error sending out discover packet from 10.255.0.1 to 10.255.255.255: Operation not permitted
Aug 27, 2022 07:55:38.405 [0xb2b07d44] DEBUG - Request came in with unrecognized domain / IP '20.1.20.24' in header Host; treating as non-local
Aug 27, 2022 07:55:38.405 [0xb2ae4d44] DEBUG - Request came in with unrecognized domain / IP '20.1.20.24' in header Host; treating as non-local
Aug 27, 2022 07:55:38.406 [0xb2b07d44] DEBUG - Request: [20.1.20.49:63843 (Subnet)] GET / (3 live) #4a22 GZIP
Aug 27, 2022 07:55:38.406 [0xb2ae4d44] DEBUG - Request: [20.1.20.49:63844 (Subnet)] GET / (3 live) #4a24 GZIP
Aug 27, 2022 07:55:38.408 [0xb2b07d44] DEBUG - Completed: [20.1.20.49:63843] 401 GET / (3 live) GZIP 0ms 435 bytes

The numbers you chose are Microsoft’s


NetRange:       20.0.0.0 - 20.31.255.255
CIDR:           20.0.0.0/11
NetName:        MSFT
NetHandle:      NET-20-0-0-0-1
Parent:         NET20 (NET-20-0-0-0-0)
NetType:        Direct Allocation
OriginAS:       
Organization:   Microsoft Corporation (MSFT)
RegDate:        2017-10-18
Updated:        2021-12-14
Ref:            https://rdap.arin.net/registry/ip/20.0.0.0

You need to change to 10 , not 20 for everything , and you’ll be fine.

@empmdk

You are getting a 403 (Forbidden) error return.

Aug 26, 2022 17:33:35.555 [0x7f788e15db00] DEBUG - [HttpClient/HCl#2] HTTP/2.0 (0.4s) 403 response from GET https://plex.tv/api/v2/server/access_tokens?auth_token=xxxxxxxxxxxxxxxxxxxx
Aug 26, 2022 17:33:35.555 [0x7f788d32ab00] ERROR - MyPlex: Error 403 requesting XML from: https://plex.tv/api/v2/server/access_tokens?auth_token=xxxxxxxxxxxxxxxxxxxx
Aug 26, 2022 17:33:35.555 [0x7f788d543b00] ERROR - MyPlex: Couldn't get list of access tokens from myPlex.

Did you change all the passwords as required ?
Then restart the server to get new certificates ?

Seems I didnt have the most current server update. Updated server and its working (maybe I just missed seeing the email !)

Thanks for all the help your providing everyone.