Jump to content

Tutorial: SSH into Synology NAS with Useful Examples


Recommended Posts

Posted
15 hours ago, Carlo said:

What plugin?
What are you trying to do?

I want to install a Smart Playlist

  • 2 months later...
Posted

Just to add my $0.02...

Synology disables the "admin" account by default partly to eliminate the low hanging fruit of having such a standard username available to would be hackers.  I believe the recommendation is to enable the admin account, create a new account with a more obscure username and admin permissions, then disable the "admin" account.

 

I have setup my Emby media file structure to be available to the internally networked Windows computers via Samba to facilitate uploading new media.  I use the excellent parental controls built into the Emby server; however, as the kiddos have gotten older and more network savvy it is too easy for them to simply go directly to the network share and get whatever they want.  Using the ownership permissions of the linux filesystem, I use the ssh interface to change the ownership and permissions of restricted media so that only the Emby server can see them.

Uploaded files are owned by the samba user, but all of the "support" files created by the Emby server are owned by Emby.  So, I first change the ownership of the folder and uploaded files to Emby, then I remove the read, write, and execute permissions for the group and others:

sudo chown -c -R emby targetfolder

sudo chmod -c -R go-rwx targetfolder

(the -c outputs each change made, the -R makes it recursive through all subfolders)

Once the group and other permissions are removed, you will also need to use sudo ls -l to see the folder contents. (And the tab auto-complete won't work.)

From the Windows machines, the folder name is visible but cannot be opened.  If you want to completely hide the media, just tuck it under a folder like "Restricted" (also without group and others permissions).  Then the Windows machines will only see the folder "Restricted" but cannot see what is inside it.

It is important to note that if the Emby server encounters any folder / file it can't read in any of its media libraries, it will abort the scan for file changes and you will notice that it no longer updates when media is changed / added / removed.  So be sure that any folder / file with the group and other permissions removed is owned by the Emby user (including its parent folders).

  • Thanks 2
  • 3 months later...
Posted

I haave Emby installed in my Synology ds223j. I forgot the password of Emby (wich is diferente to the Synology password). I can not reset it. Can you help me please?

Posted
2 hours ago, cma1960 said:

I haave Emby installed in my Synology ds223j. I forgot the password of Emby (wich is diferente to the Synology password). I can not reset it. Can you help me please?

Hi there, why can't you reset the password? What exactly happens when you try?

  • 1 month later...
Posted

Ich habe alles ausprobiert ...ich komme auf den server über das Terminal aber ich kann nichts löschen. wenn ich emby starte dann beendet es sich direkt wieder. ich habe gehört man muss den Ordner löschen...volume1/@appdata/EmbyServer aber den kann ich nicht löschen.

 

root@HomeCinema:~# rm -r /volume1/@appdata/EmbyServer

rm: cannot remove '/volume1/@appdata/EmbyServer/logs/embyserver.txt': Input/output error

rm: cannot remove '/volume1/@appdata/EmbyServer/cache/temp/f05b2baf48eb4726b676e547ea4510f7.jpg': Input/output error

rm: cannot remove '/volume1/@appdata/EmbyServer/cache/temp/89ad5c2360514d7bacd81155196d50b8.jpg': Input/output error

rm: cannot remove '/volume1/@appdata/EmbyServer/cache/temp/407beae8787b45e7880c2325d99201d5.jpg': Input/output error

rm: cannot remove '/volume1/@appdata/EmbyServer/metadata/library/08/08e3028503c0ae75e32eb4e2a15ea277': Input/output error

rm: cannot remove '/volume1/@appdata/EmbyServer/metadata/library/b0/b09ab1924969fb89d4c01d40814e7f75': Input/output error

rm: cannot remove '/volume1/@appdata/EmbyServer/metadata/library/be/be8fffebc429e6112a6f71b14ed5512a': Directory not empty

rm: cannot remove '/volume1/@appdata/EmbyServer/metadata/library/e9/e9c6e39cb29b379be6d952b91df157e6': Input/output error

 

Bitte helft mir was kann ich machen damit es wieder funktioniert.

Posted
43 minutes ago, poopspan said:

Ich habe alles ausprobiert ...ich komme auf den server über das Terminal aber ich kann nichts löschen. wenn ich emby starte dann beendet es sich direkt wieder. ich habe gehört man muss den Ordner löschen...volume1/@appdata/EmbyServer aber den kann ich nicht löschen.

 

root@HomeCinema:~# rm -r /volume1/@appdata/EmbyServer

rm: cannot remove '/volume1/@appdata/EmbyServer/logs/embyserver.txt': Input/output error

rm: cannot remove '/volume1/@appdata/EmbyServer/cache/temp/f05b2baf48eb4726b676e547ea4510f7.jpg': Input/output error

rm: cannot remove '/volume1/@appdata/EmbyServer/cache/temp/89ad5c2360514d7bacd81155196d50b8.jpg': Input/output error

rm: cannot remove '/volume1/@appdata/EmbyServer/cache/temp/407beae8787b45e7880c2325d99201d5.jpg': Input/output error

rm: cannot remove '/volume1/@appdata/EmbyServer/metadata/library/08/08e3028503c0ae75e32eb4e2a15ea277': Input/output error

rm: cannot remove '/volume1/@appdata/EmbyServer/metadata/library/b0/b09ab1924969fb89d4c01d40814e7f75': Input/output error

rm: cannot remove '/volume1/@appdata/EmbyServer/metadata/library/be/be8fffebc429e6112a6f71b14ed5512a': Directory not empty

rm: cannot remove '/volume1/@appdata/EmbyServer/metadata/library/e9/e9c6e39cb29b379be6d952b91df157e6': Input/output error

 

Bitte helft mir was kann ich machen damit es wieder funktioniert.

Hi, did you ssh into the nas?

Posted (edited)

sudo rm -r /volume1/@appdata/EmbyServer

The sudo should take care of any file permission errors. 

Did you use the <tab> auto complete as you typed the target directory? It will fill in the special characters and ensure that it is the correct upper/lower case. 

Also, be sure that any emby server background tasks have been stopped. 

Have you tried logging into the NAS via the web interface? I've had files inappropriately get locked by Windows SMB and when logged into the NAS web interface as admin it will allow me to delete them. 

Edited by Grimmer
Posted
On 7/28/2025 at 2:06 AM, Grimmer said:

sudo rm -r /volume1/@appdata/EmbyServer

The sudo should take care of any file permission errors. 

Did you use the <tab> auto complete as you typed the target directory? It will fill in the special characters and ensure that it is the correct upper/lower case. 

Also, be sure that any emby server background tasks have been stopped. 

Have you tried logging into the NAS via the web interface? I've had files inappropriately get locked by Windows SMB and when logged into the NAS web interface as admin it will allow me to delete them. 

Sorry, but nothing happens when I enter the sudo command. I copied it from your line and typed it out, but it always works the same. I'm attaching an image.

Bildschirmfoto 2025-07-29 um 13.14.21.png

Posted
On 7/28/2025 at 1:07 AM, Luke said:

Hi, did you ssh into the nas?

Ja die ssh Verbindung funktioniert super, nur weiß ich nicht was ich machen (tippen) muss damit ich Emby wieder starten kann oder am besten neu installieren.

Posted
7 hours ago, poopspan said:

Ja die ssh Verbindung funktioniert super, nur weiß ich nicht was ich machen (tippen) muss damit ich Emby wieder starten kann oder am besten neu installieren.

I would just use it to delete the server data folder:

Emby Server Data Folder

Then you can start Emby Server the usual way.

Posted
2 hours ago, Luke said:

I would just use it to delete the server data folder:

Emby Server Data Folder

Then you can start Emby Server the usual way.

Der Ordner lässt sich nicht löschen ich habe alles versucht.

ich bin die Anleitung schritt für schritt durch gegangen aber ich bekomme immer nur Fehlermeldungen das der Ordner nicht gelöscht werden kann.

Ich hänge ein Bild mit an.

 

Bildschirmfoto 2025-07-29 um 23.25.05.png

Posted

Apologies, I didn't notice that your first post was already executed as root.  Elevating to root would only resolve any file permissions issue.  Based on a quick google search, it appears that the input/output error from rm is typically associated with file system and / or hardware corruption.  Perhaps there is a deeper problem that is causing EmbyServer to immediately crash.

On a side note, it is curious that your system didn't understand the single command usage of sudo. My Synology does and I use it all the time.

 

 

Posted
5 minutes ago, Grimmer said:

Apologies, I didn't notice that your first post was already executed as root.  Elevating to root would only resolve any file permissions issue.  Based on a quick google search, it appears that the input/output error from rm is typically associated with file system and / or hardware corruption.  Perhaps there is a deeper problem that is causing EmbyServer to immediately crash.

On a side note, it is curious that your system didn't understand the single command usage of sudo. My Synology does and I use it all the time.

 

 

I thought it was a hardware issue at first, too, but my DS tells me everything's fine. Is it really that hard to delete a folder? Okay, I have no idea about that. I just wanted to use Emby. I've tried deleting other folders, but that doesn't work either. JDownloader, for example, can't be deleted.

Posted

Are those the only remaining files (all others deleted)?
If you type:

ls -l /volume1/@appdata/EmbyServer/* do you get just the files that were listed with the errors or a lot more? 

For the files that are triggering the errors, are their sizes and permissions reasonable?

You could try adding the force option (-f) to rm, but I doubt it will make a difference.

Try the web interface.  Try running file system check / repair.  This is likely different depending on your version of DSM and the filesystem type.  You will likely have to look up specific instructions for your setup.

Posted
8 minutes ago, poopspan said:

I thought it was a hardware issue at first, too, but my DS tells me everything's fine. Is it really that hard to delete a folder? Okay, I have no idea about that. I just wanted to use Emby. I've tried deleting other folders, but that doesn't work either. JDownloader, for example, can't be deleted.

Are these folders mounted by another computer?  E.g. filesharing, Samba, etc.

I think that by default Synology only does quick scans, which could easily miss isolated corruption.  In the Storage Manager, there should be options to force a detailed scan.  S.M.A.R.T. scan should have a detailed scan option.  And I believe that Synology has a "Scrub Data" option to check the file system (but only for certain types).

Has the NAS been rebooted recently?

Posted
8 minutes ago, Grimmer said:

Are these folders mounted by another computer?  E.g. filesharing, Samba, etc.

I think that by default Synology only does quick scans, which could easily miss isolated corruption.  In the Storage Manager, there should be options to force a detailed scan.  S.M.A.R.T. scan should have a detailed scan option.  And I believe that Synology has a "Scrub Data" option to check the file system (but only for certain types).

Has the NAS been rebooted recently?

That's all I see. I'm trying to clean up the file system now. We'll see if that helps. If that doesn't work, can I install Emby via Docker? I'm not familiar with it, but I'm sure there are instructions for it. Yes, the DS has been restarted several times.

Posted

The S.M.A.R.T. test is likely only going to say good or bad hardware, I don't think it can fix anything.  The Data Scrubbing is supposed to be able to fix things but could be limited by hardware failures.

Posted
2 minutes ago, Grimmer said:

The S.M.A.R.T. test is likely only going to say good or bad hardware, I don't think it can fix anything.  The Data Scrubbing is supposed to be able to fix things but could be limited by hardware failures.

Ok I try that too.

The picture show what I see if I go to...ls -l /volume1/@appdata/EmbyServer

Bildschirmfoto 2025-07-29 um 23.55.53.png

Posted (edited)

add "/*" to the end of it to list the contents of each sub-directory.

But it looks like most of the files were deleted normally the first time.  There should be more directories than just those three.

Edited by Grimmer
Posted
7 minutes ago, Grimmer said:

add "/*" to the end of it to list the contents of each sub-directory.

But it looks like most of the files were deleted normally the first time.  There should be more directories than just those three.

Unfortunately, that's all I see.

I can't imagine that's the reason why Emby won't start, or why it starts but then immediately shuts down again.

Bildschirmfoto 2025-07-30 um 00.12.52.png

Posted

embyserver.txt appears to be corrupt.  As I understand it, Emby immediately tries to open that log file upon startup.  Not being able to access this file is likely what is causing EmbyServer to immediately crash.  Perhaps there is a way to manually force EmbyServer to target a different file for its current log (or perhaps it can be coded to automatically rotate to a new target if it gets a file open error on the primary log file).

Chances are there is something similar going on in your JDownloader folder that you can't delete.  Having multiple instances of this error is concerning and leads me toward a possible HDD failure.  It may have been caused by a power failure when writing (should be fairly isolated occurrence), or it may indicate that the HDD is dying.  Hopefully the file system can be repaired by the built in utilities.  The detailed S.M.A.R.T. test might indicate if it is failing (I'm not sure how effective that scan is).  If the HDD is quite old, it may be worth it to rebuild the system on a new HDD.  If the HDD is newer, I would double check that it is seated properly in the NAS, perhaps remove and replace it and then start looking into warranty info.

image.thumb.png.9f3fc0f2f26b5c58f76b3c427a72e773.png

 

Posted
On 8/1/2025 at 2:22 AM, Luke said:

@poopspanhas this helped?

No, unfortunately not...I'm starting to despair. It MUST be possible to delete a stupid folder. I've reached the end of my knowledge; someone who really knows what they're doing needs to step in. It's really stupid to program software like this that you can't simply uninstall. Did I perhaps choose the wrong program with a lifetime subscription? Google Translate   @sa2000

  • 4 weeks later...
Posted
On 02/08/2025 at 00:20, poopspan said:

No, unfortunately not...I'm starting to despair. It MUST be possible to delete a stupid folder. I've reached the end of my knowledge; someone who really knows what they're doing needs to step in. It's really stupid to program software like this that you can't simply uninstall. Did I perhaps choose the wrong program with a lifetime subscription?

This appears to be a hard disk issue rather than an Emby issue.

Did you look into running the Synology Data Scrubbing? On the dashboard, go to  "Storage Manager" and select Volume 1. There should be an option to run "Data Scrubbing". See what results that gives. It may take a while to run.

 

 

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...