Welcome to our forums! Please take a few moments to read through our Community Guidelines (also conveniently linked in the header at the top of each page). There, you'll find guidelines on conduct, tips on getting the help you may be searching for, and more!

Plex user is a "real" user...

zpaolo11xzpaolo11x Members Posts: 959 ✭✭✭

I have a Ubuntu NUC which I just use as a Plex server, and when I installed Ubuntu on that I created a user named "plex", which is a full fledged user with home folder, login etc. When I installed PMS of course the plex user was used as the user for PMS, but now I read that in the standard installation the plex user doesn't have a home folder in the /home path and doesn't have login.

Do you think I might have issues (security?) with my setup? It was quite convenient because I didn't have to fiddle with users and groups to access my data, being the only user of the server and logging in as "plex" user when I need to work remotely on the files. Oh and when I say "remotely" I mean from a ssh shell in my local network, I don't have plex remote access or ssh outside my home network enabled.

Best Answers

  • ChuckPAChuckPA Members, Plex Pass, Plex Ninja, Plex Team Member Posts: 13,102 Plex Team Member
    edited April 2016 Accepted Answer

    If you're indeed coming at this from the 'reinstall linux' perspective, your point is completely valid. If I were to do that, I would do the following just in case I let something obnoxious into my system.

    With Plex stopped;

    1. make and give ownership to plex for /home/pdir
    2. cd /home/pdir; (cd /var/lib/plexmediaserver ; tar cf - ./Library ) | tar xf -
    3. remove the other Library under /var/lib/plexmediaserver since it's all under /home/pdir/Library
    4. create a bind (cross-mount) in /etc/fstab to make it look like it's still mounted at /var/lib/plexmediaserver
      /home/pdir /var/lib/plexmediaserver bind defaults 0 0

    (Note: some systems seem to want 'none bind' and not 'bind defaults'. Fedora likes what i have)

    1. test the mount with 'mount /home/pdir' then go look in /var/lib/plexmediaserver
    2. if all is good, restart Plex.

    Having gone through all that, why not have cron simply back up the database (using tar) and put it in your home dir on a weekly basis. Which is the ultimte 'reboot' or OOOPS protection :)

    The crontab entry for root would be:

    # Weekly backups (Sunday, 3:05am local)
    5 3 * * 7             $Home/Backup-Plex >> $Home/weekly-backup.log 2>&1
    

    The script $HOME/Backup-Plex (located in /root) would do the work

    cd /var/lib/plexmediaserver
    tar cf /home/yourusername/plexbackup.tar ./Library
    chown yourusername /home/yourusername/plexbackup.tar 
    

Answers

  • zpaolo11xzpaolo11x Members Posts: 959 ✭✭✭

    Thank you for your answer, so if I'd decide to turn on remote access, I should change the plex user disabling the login option and create a new user for ordinary maintenance... or I'll just re-install Ubuntu (maybe the fresh 16.04 LTS) and do it the proper way :)

  • ChuckPAChuckPA Members, Plex Pass, Plex Ninja, Plex Team Member Posts: 13,102 Plex Team Member
    edited April 2016

    If you do decide to enable remote access, I would do things the proper way. That said, you don't need to create a new user or reinstall ubuntu.

    If you want to change the text name, this is ridiculously easy >:)

    as root, edit /etc/passwd and change the text name field and the home directory field... then change the directory name to match the new name and reset its password.

    example:
    sudo gedit /etc/passwd
    sudo mv /home/old_username /home/new_username

    sudo passwd newuser
    __enter_new_passwd_at_prompt

  • zpaolo11xzpaolo11x Members Posts: 959 ✭✭✭

    I see, but a user named plex is still necessary (or is it not?), and default location of its home folder should be in /var/lib and not in /home... On the other hand if I want to remote ssh to my server then my user, be it named plex or whatever, will need to be able to login anyway. Oh well it's just speculation, with my <1Mbit upload speed using plex in remote is not a priority :D

  • zpaolo11xzpaolo11x Members Posts: 959 ✭✭✭

    What you outlined is exactly what I'd do if/when I'll have some time to dedicate to my server. Why do you say that having the plex library in /home/plex makes it easier to wipe the database? You mean if I do it by mistake while being logged as root? Actually I like the idea of having the plex folder away from /var/lib, that way If I need to reinstall linux I can ask it not to format /home folder, so it might be less easy to wipe it that way

  • ChuckPAChuckPA Members, Plex Pass, Plex Ninja, Plex Team Member Posts: 13,102 Plex Team Member
    edited April 2016 Accepted Answer

    If you're indeed coming at this from the 'reinstall linux' perspective, your point is completely valid. If I were to do that, I would do the following just in case I let something obnoxious into my system.

    With Plex stopped;

    1. make and give ownership to plex for /home/pdir
    2. cd /home/pdir; (cd /var/lib/plexmediaserver ; tar cf - ./Library ) | tar xf -
    3. remove the other Library under /var/lib/plexmediaserver since it's all under /home/pdir/Library
    4. create a bind (cross-mount) in /etc/fstab to make it look like it's still mounted at /var/lib/plexmediaserver
      /home/pdir /var/lib/plexmediaserver bind defaults 0 0

    (Note: some systems seem to want 'none bind' and not 'bind defaults'. Fedora likes what i have)

    1. test the mount with 'mount /home/pdir' then go look in /var/lib/plexmediaserver
    2. if all is good, restart Plex.

    Having gone through all that, why not have cron simply back up the database (using tar) and put it in your home dir on a weekly basis. Which is the ultimte 'reboot' or OOOPS protection :)

    The crontab entry for root would be:

    # Weekly backups (Sunday, 3:05am local)
    5 3 * * 7             $Home/Backup-Plex >> $Home/weekly-backup.log 2>&1
    

    The script $HOME/Backup-Plex (located in /root) would do the work

    cd /var/lib/plexmediaserver
    tar cf /home/yourusername/plexbackup.tar ./Library
    chown yourusername /home/yourusername/plexbackup.tar 
    
Sign In or Register to comment.