Skip to content

Instantly share code, notes, and snippets.

@MarMed
MarMed / README.md
Last active May 1, 2024 12:18
Routing plex traffic through an SSH tunnel

Routing plex traffic through an SSH tunnel

This guide creates a reverse SSH tunnel to route all Plex server traffic through it.

Step 2 is done on the tunnel, all other steps are done on the plex server.

1. Setup SSH keys (if you already have key based authenthication setup skip to step 2)

On plex server:

#!/bin/sh
# See: https://github.com/Radarr/Radarr/wiki/Mass-Delete-via-API
HOST=http://radarr.local:7878
API_KEY= # Settings > General
ids=$(curl --silent $HOST/api/movie -X GET -H "X-Api-Key: $API_KEY" \
| jq '.[] | select(.monitored == false) | .id')
#### systemd script (/etc/systemd/system/plexdrive.service):
[Unit]
Description=Plexdrive
AssertPathIsDirectory=/media/plexdrive/
After=network-online.target
[Service]
Type=simple
ExecStart=/usr/bin/plexdrive -fuse-options allow_other -log-level 2 /media/plexdrive/
ExecStop=/bin/fusermount -u /media/plexdrive/
# you will need to download nzbdrone.db & some type of sqlite editor
# First We Will Update The Series Table
# Replace the slashes
UPDATE Series SET path = replace( path, '\', '/' ) WHERE path LIKE '%:\%';
# K: is the windows drive that your files were on (replace this with whatever drive your files are on, will need to repeat for each
# windows root folder you have in Sonnar), /home/new/path/in/linux is well the new path in linux
UPDATE Series SET path = replace( path, 'K:', '/home/new/path/in/linux' ) WHERE path LIKE 'K:/%';
# Fix slashes in EpisodeFiles table
UPDATE EpisodeFiles SET RelativePath = replace( RelativePath, '\', '/' ) WHERE RelativePath LIKE '%\%';
@jaketame
jaketame / data-media.mount
Last active May 2, 2021 09:36
PlexDrive / rclone crypt / overlayfs service files
# Install this under /lib/systemd/system
# systemctl enable data-media.mount
# systemctl start data-media.mount
[Unit]
Description=Google Drive (overlay)
After=rclonecrypt.service
[Mount]
What=overlay
Where=/data/media