Running on Synology Docker with SSH and Samba
I have been trying to get this work on Synology docker homebridge with a Win 10 machine using SSH and finally managed to get it working. As a linux idiot, I was really struggling. I don't know if these instructions will be able to help other people but I am posting them anyway.

**Initial Set-up**
_**Homebridge:**_ add Docker container startup script these lines (You can add these with with homebridge config-ui-x menu)
		apk add --no-cache samba samba-common-tools
		apk add --no-cache openssh-client
Restart the docker container.

Arrange your config file:

        {
            "accessory": "NetworkDevice",
            "name": "pc_name",
            "mac": "mac",
            "ip": "ip_address",
            "pingInterval": 2,
            "pingsToChange": 5,
            "pingTimeout": 1,
            "wakeGraceTime": 45,
            "shutdownGraceTime": 60,
            "shutdownCommand": "ssh -o StrictHostKeyChecking=no -i /homebridge/id_rsa username@remote_Address shutdown /s"
        }

**Wake-on-lan Win 10**
It is pretty basic.
Check your BIOS settings if WOL is enabled.
Check your win 10 network interface from device manager if the magic packets are enabled.

**Shutdown Win 10 with SSH**

**_Win 10:_** Enable OpenSSH Client and Server from win 10 programs and features.
**_Win 10:_** run Services.msc and make Open SSH Server start automatically
**_Homebridge:_** Open homebridge terminal. (You can use the terminal of homebridge config-ui-x)
**_Homebridge:_** Generating ssh keys
		/homebridge # ssh-keygen
		Generating public/private rsa key pair.
		Enter file in which to save the key (/root/.ssh/id_rsa): /homebridge/id_rsa
		Enter passphrase (empty for no passphrase):
		Enter same passphrase again:
		Your identification has been saved in /homebridge/my-key.
		Your public key has been saved in /homebridge/my-key.pub.
		/homebridge #
		
**_Homebridge:_** Try to connect to your win10 machine with SSH from homebridge. It will ask for password but no problem
		ssh username@ip_address

**_Win 10:_** Navigate the homebridge folder on the NAS and copy the generated id_rsa.pub file to somewhere on your computer.
**_Win 10:_** Launch a text editor with admin priviledges, open the file C:\ProgramData\ssh\sshd_config and comment out the lines shown below.
	#Match Group administrators
	#       AuthorizedKeysFile __PROGRAMDATA__/ssh/administrators_authorized_keys

**_Win 10:_** Open id_rsa.pub with a file editor and copy the contents.
	Navigate to the C:\Users\username\\.ssh folder.
	Using text editor, create a new file and paste the contents you copied before.
	Save this file to C:\Users\username\\.ssh folder with name "authorized_keys" (no file extension). This file should be located in the C:\Users\username\\.ssh.
	Right click authorized_keys
    	Go to Properties\Security\Advanced
    	Click “Disable Inheritance”, then choose “Convert inherited permissions into explicit permissions on this object”
    	Remove all permissions on the file except for SYSTEM and your user. There should only be two entries in the list, both with “Full Control”
**_Win 10:_** run Services.msc and restart OpenSSH SSH Server

Now you should be able to login without password with your key pairs.

**_Homebridge:_** check if you can connect. You might need to specify your private key in this command.
	ssh -i /homebridge/id_rsa username@remote_Address
**_Homebridge:_** Use your shutdown command
	ssh -o StrictHostKeyChecking=no -i /homebridge/id_rsa username@remote_Address shutdown /s
You can customize your command. Check out https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/shutdown




