# Server credential reset utility for Linux-based platforms

**URL:** <https://forums.plex.tv/t/server-credential-reset-utility-for-linux-based-platforms/807107>\
**Category:** Tips, Tricks & How-Tos\
**Tags:** server-linux, server-asustor, server-docker, server-netgear, server-synology, server-western-digital, tipstricks\
**Created:** [August 26, 2022, 1:19am UTC](https://forums.plex.tv/t/server-credential-reset-utility-for-linux-based-platforms/807107 "2022-08-26T01:19:31Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![ChuckPa](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/chuckpa/32/79710_2.png) [@ChuckPa](https://forums.plex.tv/u/ChuckPa)\
**Post date:** [August 26, 2022, 1:19am UTC](https://forums.plex.tv/t/server-credential-reset-utility-for-linux-based-platforms/807107/1 "2022-08-26T01:19:31Z")

</div>

## 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](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](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 😈

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

#### How it looks in use

```auto
[~] # ./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:

```auto
[~] # ./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:

```auto
./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

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

#### Please see the README.md f

[ReadMe](https://github.com/ChuckPa/UserCredentialReset#readme)

[UserCredentialReset.tar](https://github.com/ChuckPa/UserCredentialReset/releases/latest)

---

<div class="post-metadata">

**Author:** ![lhengen](https://avatars.discourse-cdn.com/v4/letter/l/8baadc/32.png) [@lhengen](https://forums.plex.tv/u/lhengen)\
**Post date:** [August 26, 2022, 2:23am UTC](https://forums.plex.tv/t/server-credential-reset-utility-for-linux-based-platforms/807107/2 "2022-08-26T02:23:06Z")

</div>

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"

---

<div class="post-metadata">

**Author:** ![ChuckPa](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/chuckpa/32/79710_2.png) [@ChuckPa](https://forums.plex.tv/u/ChuckPa)\
**Post date:** [August 26, 2022, 2:46am UTC](https://forums.plex.tv/t/server-credential-reset-utility-for-linux-based-platforms/807107/3 "2022-08-26T02:46:55Z")

</div>

Pinned on August 26, 2022, 2:46am UTC



---

<div class="post-metadata">

**Author:** ![ab1000000](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/ab1000000/32/246542_2.png) [@ab1000000](https://forums.plex.tv/u/ab1000000)\
**Post date:** [August 26, 2022, 3:21am UTC](https://forums.plex.tv/t/server-credential-reset-utility-for-linux-based-platforms/807107/4 "2022-08-26T03:21:48Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![gazmeist](https://avatars.discourse-cdn.com/v4/letter/g/b4bc9f/32.png) [@gazmeist](https://forums.plex.tv/u/gazmeist)\
**Post date:** [August 26, 2022, 3:31am UTC](https://forums.plex.tv/t/server-credential-reset-utility-for-linux-based-platforms/807107/5 "2022-08-26T03:31:08Z")

</div>

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 😛

---

<div class="post-metadata">

**Author:** ![ChuckPa](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/chuckpa/32/79710_2.png) [@ChuckPa](https://forums.plex.tv/u/ChuckPa)\
**Post date:** [August 26, 2022, 3:35am UTC](https://forums.plex.tv/t/server-credential-reset-utility-for-linux-based-platforms/807107/6 "2022-08-26T03:35:34Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![conplex](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/conplex/32/269589_2.png) [@conplex](https://forums.plex.tv/u/conplex)\
**Post date:** [August 26, 2022, 4:42am UTC](https://forums.plex.tv/t/server-credential-reset-utility-for-linux-based-platforms/807107/7 "2022-08-26T04:42:00Z")

</div>

How do you run it when using docker ([Docker Hub](https://hub.docker.com/r/plexinc/pms-docker/))?

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.

---

<div class="post-metadata">

**Author:** ![gseguin1](https://avatars.discourse-cdn.com/v4/letter/g/96bed5/32.png) [@gseguin1](https://forums.plex.tv/u/gseguin1)\
**Post date:** [August 26, 2022, 5:29am UTC](https://forums.plex.tv/t/server-credential-reset-utility-for-linux-based-platforms/807107/8 "2022-08-26T05:29:06Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![ChuckPa](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/chuckpa/32/79710_2.png) [@ChuckPa](https://forums.plex.tv/u/ChuckPa)\
**Post date:** [August 26, 2022, 5:50am UTC](https://forums.plex.tv/t/server-credential-reset-utility-for-linux-based-platforms/807107/9 "2022-08-26T05:50:01Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![nebbles](https://avatars.discourse-cdn.com/v4/letter/n/f05b48/32.png) [@nebbles](https://forums.plex.tv/u/nebbles)\
**Post date:** [August 26, 2022, 11:06am UTC](https://forums.plex.tv/t/server-credential-reset-utility-for-linux-based-platforms/807107/12 "2022-08-26T11:06:03Z")

</div>

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

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

```

Any advice? Thanks

---

<div class="post-metadata">

**Author:** ![rogc](https://avatars.discourse-cdn.com/v4/letter/r/df788c/32.png) [@rogc](https://forums.plex.tv/u/rogc)\
**Post date:** [August 26, 2022, 11:37am UTC](https://forums.plex.tv/t/server-credential-reset-utility-for-linux-based-platforms/807107/13 "2022-08-26T11:37:43Z")

</div>

> [@ChuckPa](#):
>
> sudo bash ./UserCredentialReset.sh

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!

---

<div class="post-metadata">

**Author:** ![ChuckPa](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/chuckpa/32/79710_2.png) [@ChuckPa](https://forums.plex.tv/u/ChuckPa)\
**Post date:** [August 26, 2022, 12:59pm UTC](https://forums.plex.tv/t/server-credential-reset-utility-for-linux-based-platforms/807107/14 "2022-08-26T12:59:12Z")

</div>

@rogc

Please point me to it?

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

---

<div class="post-metadata">

**Author:** ![vivid.water](https://avatars.discourse-cdn.com/v4/letter/v/f04885/32.png) [@vivid.water](https://forums.plex.tv/u/vivid.water)\
**Post date:** [August 26, 2022, 1:32pm UTC](https://forums.plex.tv/t/server-credential-reset-utility-for-linux-based-platforms/807107/15 "2022-08-26T13:32:55Z")

</div>

@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

---

<div class="post-metadata">

**Author:** ![ChuckPa](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/chuckpa/32/79710_2.png) [@ChuckPa](https://forums.plex.tv/u/ChuckPa)\
**Post date:** [August 26, 2022, 1:48pm UTC](https://forums.plex.tv/t/server-credential-reset-utility-for-linux-based-platforms/807107/16 "2022-08-26T13:48:17Z")

</div>

@vivid.water

What are you doing running NotePad on Linux? 😱 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`

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

---

<div class="post-metadata">

**Author:** ![ChuckPa](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/chuckpa/32/79710_2.png) [@ChuckPa](https://forums.plex.tv/u/ChuckPa)\
**Post date:** [August 26, 2022, 1:53pm UTC](https://forums.plex.tv/t/server-credential-reset-utility-for-linux-based-platforms/807107/17 "2022-08-26T13:53:04Z")

</div>

> [@nebbles](#):
>
> 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
> 
> ```auto
> Aug 26, 2022 12:00:25: Failed to initialize logging: Empty or non-existant file.
> 
> ```

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.

---

<div class="post-metadata">

**Author:** ![yeffiely](https://avatars.discourse-cdn.com/v4/letter/y/839c29/32.png) [@yeffiely](https://forums.plex.tv/u/yeffiely)\
**Post date:** [August 26, 2022, 2:22pm UTC](https://forums.plex.tv/t/server-credential-reset-utility-for-linux-based-platforms/807107/18 "2022-08-26T14:22:35Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![ph4499](https://avatars.discourse-cdn.com/v4/letter/p/a8b319/32.png) [@ph4499](https://forums.plex.tv/u/ph4499)\
**Post date:** [August 26, 2022, 2:54pm UTC](https://forums.plex.tv/t/server-credential-reset-utility-for-linux-based-platforms/807107/19 "2022-08-26T14:54:57Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![adammallard23\_gmail\_com](https://avatars.discourse-cdn.com/v4/letter/a/eb9ed0/32.png) [@adammallard23\_gmail\_com](https://forums.plex.tv/u/adammallard23_gmail_com)\
**Post date:** [August 26, 2022, 2:57pm UTC](https://forums.plex.tv/t/server-credential-reset-utility-for-linux-based-platforms/807107/20 "2022-08-26T14:57:00Z")

</div>

Does this work for TrueNas users?

---

<div class="post-metadata">

**Author:** ![ChuckPa](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/chuckpa/32/79710_2.png) [@ChuckPa](https://forums.plex.tv/u/ChuckPa)\
**Post date:** [August 26, 2022, 3:15pm UTC](https://forums.plex.tv/t/server-credential-reset-utility-for-linux-based-platforms/807107/21 "2022-08-26T15:15:06Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![ChuckPa](https://sea1.discourse-cdn.com/plex/user_avatar/forums.plex.tv/chuckpa/32/79710_2.png) [@ChuckPa](https://forums.plex.tv/u/ChuckPa)\
**Post date:** [August 26, 2022, 3:17pm UTC](https://forums.plex.tv/t/server-credential-reset-utility-for-linux-based-platforms/807107/22 "2022-08-26T15:17:14Z")

</div>

> [@yeffiely](#):
>
> 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?

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.

[Next page](https://forums.plex.tv/t/server-credential-reset-utility-for-linux-based-platforms/807107.md?page=2)
