Sunday, September 3, 2017

Regain Access to Plex Server When Locked Out


How to Regain Access to Your Plex Server When You’re Locked Out


For the most part, the Plex Media Server experience is pretty flawless. You install the server software, you point your Plex clients at it, and start watching your movies. But sometimes, you’ll go to log into your server only to be mysteriously shut out. Let’s dig into some arcane settings and get you back to media nirvana.
The issue manifests itself in a few different ways, but the common element is that when you go to log into your web-based control panel for your Plex server either you can’t access the control panel at all, and get an error like “You do not have permission to access this server.” Or, if you’ve ever dabbled with multiple servers or have removed and installed your Plex server on the same machine with a different account, you’ll be unable to log in with the account you wish to use.
The problem is that deep behind the scenes in the Windows Registry (or in text-based configuration files on macOS and Linux), there’s an issue with how the login credentials for your account have been stored. By diving into the settings and erasing the stored tokens for your login, you can force Plex to ask for them again and get a fresh error-free login.
Note: Before we proceed, to be clear, this process is not about resetting your password and getting a new one from the Plex company (if you need to do so, you can do that here). Instead, this is about forcing your local Plex server to forget previously entered information so you can reenter it and properly authenticate with the central Plex login server.

How to Reset Your Plex Login Token

While the basic information we need to remove (to trigger the reset) is exactly the same on every operating system, that information is located in a different place depending on your system. Let’st take a look first at how to reset your login token on Windows, and then highlight where to find the necessary files on macOS and Linux (and other UNIX-derived) operating systems.
Before performing any edits on any operating system, stop your Plex Media Server first.

Windows: Delete the Appropriate Registry Entries

Open up the Registry Editor by typing “regedit” in the Start Menu search box and run the application. Inside the registry, navigate to Computer\HKEY_CURRENT_USER\Software\Plex, Inc.\Plex Media Server in the left-hand tree as seen below.
Locate the following four entries:
  • PlexOnlineMail
  • PlexOnlineToken
  • PlexOnlineUsername
  • PlexOnlineHome (Only some users will have this—if you are not using the Plex Home managed users feature, then you will not have this entry.)
Right-click on each of these entries and select “Delete”.
These four entries correspond to your email address, a unique identifier supplies by the central Plex server, your username, and your Plex Home status, respectively. Removing them will force your Plex server to populate them again the next time you attempt to log into your server from your browser.

macOS: Edit the Plist File

On macOS, the same tokens are located inside the com.plexapp.plexmediaserver.plist file, which you’ll find in the ~/Library/Preferences/ directory. The fastest way to edit the file is to open FInder, click Go > Go to Folder in the menu bar, and paste ~/Library/Preferences/ into the box that appears. From there, scroll down until you see the com.plexapp.plexmediaserver.plist file. Be sure to stop your Plex server before performing the following edit.
Open the file with a text editor and remove the following entries:
<key>PlexOnlineHome</key>
<true/>

<key>PlexOnlineMail</key>
<string>you@youremail.com</string>

<key>PlexOnlineToken</key>
<string>XXXXXXXXXXXXXXXXXXXXX</string>

<key>PlexOnlineUsername</key>
<string>YourUserName</string>
You may not have an entry for “PlexOnlineHome” if you don’t use the Plex Home feature, but you should have an entry for the remaining three tokens. After editing and saving the file, start your Plex Media Server again and log into your server from your browser to reauthenticate yourself.

Linux: Edit the Preferences.xml File

In Linux, you just need to make a little edit to a text-based configuration file—in this case, Plex’s Preferences.xml . The general location for the file on Linux is $PLEX_HOME/Library/Application Support/Plex Media Server/ , but it is located in /var/lib/plexmediaserver/Library/Application Support/Plex Media Server/  for Debian, Fedora, Ubuntu, and CentOS installs. If you have a UNIX-derived OS like FreeBSD or a NAS device, check out the full location list here.
Open the Preferences.xml file in the text editor of your choice. Locate and remove the following entries:
PlexOnlineHome="1"
PlexOnlineMail="you@youremail.com"
PlexOnlineToken="XXXXXXXXXXXXXXXXXXXXX"
PlexOnlineUsername="YourUserName"
Save the file and then start your Plex Media Server again. Log into your server from your web browser with your Plex credentials and you should be up and running again.

That’s all there is to it. As frustrating as the phantom login problem can be, as soon as you locate the correct file and make a small edit then you’re back in business and able to login with your Plex credentials.

No comments:

Post a Comment