MagicPinball 3 Posted December 5, 2022 Share Posted December 5, 2022 (edited) I want to backup just the watched status databaseon on my Synology NAS using the Emby package. Using WinSCP, I see library.db in the "/var/packages/EmbyServer/var/data" folder. Using WinSCP, I can copy library.db to a local Windows folder. But, I cannot copy back to the NAS. I get a permission error. I try to change the permission error : chmod: changing permissions of 'library.db': Operation not permitted. How do I change the permission to library.db so I can copy my local file to the NAS? My knowledge of linux is minimal. Edited December 5, 2022 by MagicPinball Link to comment Share on other sites More sharing options...
Luke 37090 Posted December 5, 2022 Share Posted December 5, 2022 Hi, have you taken a look at this? That may help you. Link to comment Share on other sites More sharing options...
MagicPinball 3 Posted December 5, 2022 Author Share Posted December 5, 2022 (edited) I tried to create a script and run it as a Synology Scheduled Task. I tried using pscp.exe within the script and then I realized, how would Synology find the correct PC to excute it. I really do not know linux. I know basic ls, cp, cd, chmod and a couple other commands and that is my limit. I do know Windows very well. I also tried: cp /var/packages/EmbyServer/var/data/ /volume1/Download/library.db which worked. But the reverse got this error, same as in WinSCP Standard output/error: cp: cannot create regular file '/var/packages/EmbyServer/var/data/library.db': Permission denied I assume you showed me the Synology Scheduled Task and that would bypass the permission issue? I just want to be able to copy library.db to/from Synology to/from Windows. If it wasn't for the permission issue, this would be simple (I think) Any further info/suggestions? Edited December 5, 2022 by MagicPinball Link to comment Share on other sites More sharing options...
MagicPinball 3 Posted December 7, 2022 Author Share Posted December 7, 2022 All I am trying to do is backup/restore the watched list using library.db. I just cannot restore the file given the permissions. Any help? Link to comment Share on other sites More sharing options...
Luke 37090 Posted December 7, 2022 Share Posted December 7, 2022 Hi, have you checked the permissions of the file? Link to comment Share on other sites More sharing options...
MagicPinball 3 Posted December 7, 2022 Author Share Posted December 7, 2022 Permission on Synology, Emby server: If I try to change the permissions, I get an error: Link to comment Share on other sites More sharing options...
Luke 37090 Posted December 11, 2022 Share Posted December 11, 2022 Hi @MagicPinball if the file is on the Synology Server then you'll need to change the permissions from there, not from Windows. Can you please take a look at this article: it goes over how to set permissions in Synology. Please let us know if this helps. Thanks. Link to comment Share on other sites More sharing options...
Luke 37090 Posted December 11, 2022 Share Posted December 11, 2022 One other thing, is Emby Server on Synology running when you try to do this? Make sure to shut it down first. You won't be able to replace the file while the server is using it. Link to comment Share on other sites More sharing options...
unisoft 282 Posted December 11, 2022 Share Posted December 11, 2022 On 07/12/2022 at 02:57, MagicPinball said: All I am trying to do is backup/restore the watched list using library.db. I just cannot restore the file given the permissions. Any help? login as root user in WinSCP? You'll have to change Synology's default password first. log in as "admin" then run sudo su - to become "root". The sudo password is identical to the password of the "admin" user. Alternative method here using Telnet for a short time: https://primalcortex.wordpress.com/2012/08/25/synology-dsm-root-password-for-ssh/ Link to comment Share on other sites More sharing options...
MagicPinball 3 Posted December 11, 2022 Author Share Posted December 11, 2022 Luke, The directory I am trying to access (/var) is off the root and not accessible from a Shared Folder. Cannot change file permissions from there. Unisoft, I've tried to run the "sudo su -" command a couple different ways in WinSCP using SFTP and SCP protocols. I cannot seem to get this to work. I am not familiar with WinSCP and only guessing how to use your instructions. Any help? Link to comment Share on other sites More sharing options...
unisoft 282 Posted December 12, 2022 Share Posted December 12, 2022 23 hours ago, MagicPinball said: Luke, The directory I am trying to access (/var) is off the root and not accessible from a Shared Folder. Cannot change file permissions from there. Unisoft, I've tried to run the "sudo su -" command a couple different ways in WinSCP using SFTP and SCP protocols. I cannot seem to get this to work. I am not familiar with WinSCP and only guessing how to use your instructions. Any help? Did you use telnet or SSH and login as admin user first? After you connect and change the password (like I did), I then just login using WinSCP and root and can do anything (so far anyway) on the NAS. Link to comment Share on other sites More sharing options...
MagicPinball 3 Posted December 12, 2022 Author Share Posted December 12, 2022 (edited) I was able to change the permission as shown in WinSCP, but the copy still didn't work. Edited December 12, 2022 by MagicPinball Link to comment Share on other sites More sharing options...
Luke 37090 Posted December 20, 2022 Share Posted December 20, 2022 is Emby Server on Synology running when you try to do this? Make sure to shut it down first. You won't be able to replace the file while the server is using it. Link to comment Share on other sites More sharing options...
Happy2Play 8293 Posted December 20, 2022 Share Posted December 20, 2022 6 minutes ago, Luke said: is Emby Server on Synology running when you try to do this? Make sure to shut it down first. You won't be able to replace the file while the server is using it. @MagicPinball Per the image all other dbs are closed so it suggests the library.db did not close properly. Link to comment Share on other sites More sharing options...
MagicPinball 3 Posted December 21, 2022 Author Share Posted December 21, 2022 Emby was shut down. Link to comment Share on other sites More sharing options...
Happy2Play 8293 Posted December 21, 2022 Share Posted December 21, 2022 @cayarsyou have any idea what is happening here? Link to comment Share on other sites More sharing options...
Carlo 4330 Posted December 21, 2022 Share Posted December 21, 2022 (edited) When ever you copy database files you MUST shutdown Emby first. It's possible you copied the file when Emby was open which could corrupt the database. Then of course putting it back is going to cause issues. I don't use WinSCP as I just use the Synology File Manager to grab files from my local system while copies them to the proper directory (or vice versa). Normally File Manager can't see anything under the @appdata directory, but I didn't like that so I "fixed it" for my own use. I haven't shared how to do this as Synology hid these folders on purpose but if you do it the way I do it, mapping to my own home directory it's only available to my own username. If there's interest in this I'll write up a tutorial how to do this along with how to set permissions of the Emby files which I could setup to run as a Task Schedule manual run job. That should make life a little easier. I can also include how to reset Emby file permissions via SSH as well in case this is needed. Worse case the task manager script will make sense by understanding the procedure from the command line. Carlo PS I would want a couple advanced Linux guys running a Synology NAS to test first. Then let me know if they see any issues before I'd release this info publicly. Edited December 21, 2022 by cayars 1 Link to comment Share on other sites More sharing options...
Eigeplackter 75 Posted December 21, 2022 Share Posted December 21, 2022 3 minutes ago, cayars said: I haven't shared how to do this as Synology hid these folders on purpose but if you do it the way I do it, mapping to my own home directory it's only available to my own username. If there's interest in this I'll write up a tutorial how to do this along with how to set permissions of the Emby files which I could setup to run as a Task Schedule manual run job. That should make life a little easier. I can also include how to reset Emby file permissions via SSH as well in case this is needed. Worse case the task manager script will make sense by understanding the procedure from the command line. +1 Would really appreciate it. I‘m not really deep into linux, but since I own the syno I‘m „forced“ to learn my bit every day tinkering to fullfill some wishes So probably no candidate for the beta test, but really looking fwd to it. Link to comment Share on other sites More sharing options...
MagicPinball 3 Posted December 21, 2022 Author Share Posted December 21, 2022 This would be good if not too complicated. My Linux knowledge is minimal at best. But if someone could help with accessing library.db, that would be great. And yes, Emby server is shutdown before copying to/from Synology NAS. Question: I noticed that "emby" is the owner of this file. What if I create an account named "emby"? Link to comment Share on other sites More sharing options...
Carlo 4330 Posted December 23, 2022 Share Posted December 23, 2022 "Emby" isn't a normal account but a system internal account. You can switch the owner a file via File Station so that's the easy part. If you have any spare time later tonight or tomorrow I could write it up, Teamview in with you to let you follow the instructions as I watch. I could then help you get this fixed up and working well again. Carlo Link to comment Share on other sites More sharing options...
MagicPinball 3 Posted December 23, 2022 Author Share Posted December 23, 2022 Thank you for your offer, but given the time of year, I don't have the time. My version of Emby in Synology is working perfectly. I just wanted to grab a copy of watched movies (library.db), which I can do. If needed, I wanted to be able to replace library.db in case of an issue. This step eludes me, given the permissions. If there is a write-up available, I could try it next week, My PC knowledge is excellent; my Linux is poor. Link to comment Share on other sites More sharing options...
MagicPinball 3 Posted January 25, 2023 Author Share Posted January 25, 2023 Is there a write-up on this process? You stated " You can switch the owner a file via File Station..." The problem is that you cannot navigate higher than Synology's Shared folders. Link to comment Share on other sites More sharing options...
Luke 37090 Posted January 25, 2023 Share Posted January 25, 2023 55 minutes ago, MagicPinball said: Is there a write-up on this process? You stated " You can switch the owner a file via File Station..." The problem is that you cannot navigate higher than Synology's Shared folders. Hi, where exactly are you getting stuck? Link to comment Share on other sites More sharing options...
MagicPinball 3 Posted January 25, 2023 Author Share Posted January 25, 2023 In this thread, I have described how I can get library.db for backup (primarily for watched status). The problem is restoring library.db, if needed. I am using Emby in a Synology NAS. I restore a copy of the file because the owner is Synology and I cannot change that permission, thus I get a permision error when trying to copy it to the NAS. I have supplied screen shots earlier in this thread. @cayars Link to comment Share on other sites More sharing options...
Carlo 4330 Posted January 27, 2023 Share Posted January 27, 2023 By far the easiest method is using Emby's Configuration Backup plugin which easily handles full or partial restores as well. I'm not sure what you mean by the "owner is Synology" as that isn't normally a valid username in the DSM OS running on Synology. But it really doesn't matter what the owner of the file is currently as you need to SSH into the box. Go Super User, then copy the database file overtop the present file (while Emby is Shutdown). Then after the file is in place you would need to change ownership and then set access permissions. The 4 commands you would use at the command line in SSH are "sudo -i" to start an interactive super user session, cp to do the copying, chown to change owner and chmod to change/modify permissions. After doing the above you can restart Emby Server. If you have trouble figuring this out, send me a PM and we can setup and do a remote support session and I'll assist you with the above, Carlo Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now