![]() |
How to copy "Devices AccessToken" from an istance of Jellyfn to another? - Printable Version +- Jellyfin Forum (https://forum.jellyfin.org) +-- Forum: Support (https://forum.jellyfin.org/f-support) +--- Forum: General Questions (https://forum.jellyfin.org/f-general-questions) +--- Thread: How to copy "Devices AccessToken" from an istance of Jellyfn to another? (/t-how-to-copy-devices-accesstoken-from-an-istance-of-jellyfn-to-another) |
How to copy "Devices AccessToken" from an istance of Jellyfn to another? - I-G-1-1 - 2025-06-07 My issue: sometime I have to make maintenance on my main server running Jellyfin (A), so to avoid my family loose Jellyfin access I spin up another istance of Jellyfin on another server (B) and NGINX provide to automatically route to this istance. At the boot istance B get user watched items from Trakt and the whole "server switch" would be transparent to the user except for the fact that now istance B ask the user to authenticate. As family it's not so techy, it becomes a real issue as they don't know how to re-authenticate. So my question is: how can I transfer the "AccessToken" from istance A to istance B without copying every time all the /var/lib/jellyfin folder? Istance B initially was a clone of a Proxmox LXC of the istance A, so users and their "UserId" are the same. I see that /var/lib/jellyfin/data/jellyfin.db has a table called "Devices" that contains the "AccessToken". Would be enough to copy this table from the database A to database B? If yes, how can I do this using a bash script (I'm not a programmer)? Basically I need to: 1. extract "Devices" table from jellyfin.db of istance A and save to some file 2. scp the file to server B 3. import "Devices" table to jellyfin.db of istance B (replace the whole table could be good enough) Any help would be appreciated, thanks RE: How to copy "Devices AccessToken" from an istance of Jellyfn to another? - I-G-1-1 - 2025-06-07 This work only if the "UserID" (not only the username) are the same for a specific username in the two Jellyfin istances. I use it with a NGINX reverse proxy configuration that redirect to istance B if istance A is offline. Here is the part of the NGINX configuration that handle the switch: Code: upstream backend { then in each location (/ and /socket) instead of using Code: proxy_pass http://[IPADDRESS]:8096/; Code: proxy_pass http://backend/; Change [USER] and [IPADDRESS] with your data. on server A: sudo apt-get install sqlite3 cd /home/[USER] nano export_accesstoken.sh Code: #!/bin/sh sudo ssh-keygen -f /root/.ssh/id_rsa_for_JFBK vi /root/.ssh/id_rsa_for_JFBK.pub --> copy the key to /home/[USER]/.ssh/authorized_keys on server B on server B: sudo apt-get install sqlite3 cd /home/[USER] nano import_accesstoken.sh Code: #!/bin/sh sudo chown root:root /home/[USER]/import_accesstoken.sh sudo chmod 700 /home/[USER]/import_accesstoken.sh sudo visudo /etc/sudoers.d/[USER] Code: Cmnd_Alias [USER]_CMDS = /usr/bin/sh /home/[USER]/import_accesstoken.sh on server A run Code: sudo /home/[USER]/export_accesstoken.sh now server B has the same accesstoken of server A |