Have a look at the information in this how-to, specifically “Customizing your Plex configuration on systemd based systems.”
The short version is:
- Stop Plex Media Server if it is running.
- Run
sudo systemctl edit plexmediaserver. - In the editor which opens, add something like the following, and save it:
[Service]
User=pi
Group=pi
- Reload the service information by running
sudo systemctl daemon-reload plexmediaserver. - When PMS next starts, it should run as user
pi, so ensure that its data directory is owned by the correct user. If you haven’t moved the Plex data directory, something like the following should work:sudo chown -R pi:pi /var/lib/plexmediaserver - Start Plex Media Server.
Assuming everything completed successfully, PMS should now be running as pi.