I was looking for a solution to restart my always running Synology NAS like the System or Pimatic sudo reboot rule.
My steps for a working SSH connection Raspberry Pi to Synology:
SSH to Raspberry Pi
pi@raspberrypi (SSH login)
pi@raspberrypi> sudo passwd root
pi@raspberrypi> su root
root@raspberrypi> ssh-keygen -t rsa (without passphrase, in default folder)
root@raspberrypi> cd .ssh
root@raspberrypi> dir (shows id_rsa and id_rsa.pub private an public key file)
root@raspberrypi> cat id_rsa.pub (public key seems correct)
root@raspberrypi> ssh-copy-id root@192.168.1.100 (copy public key to Synology)
SSH to Synology
root@Synology-DiskStation (SSH login)
DiskStation> cd .ssh
DiskStation> dir (shows a known_host and the copied authorized_keys public key file)
DiskStation> cat authorized_keys (public key seems correct, equal with id_rsa.pub on Raspberry Pi)
DiskStation> cd
DiskStation> chmod 700 .ssh
DiskStation> chmod 644 .ssh/authorized_keys
Pimatic device
{
"id": "system-restart",
"name": "System Restart",
"class": "ButtonsDevice",
"buttons": [
{
"id": "system-restart-synology",
"text": "Synology"
}
]
},
Pimatic rule
{
"id": "system-action-restart-synology",
"name": "system-restart-synology",
"rule": "if system-restart-synology is pressed then execute \"ssh root@192.168.1.100 'echo C >/dev/ttyS1'\"",
"active": true,
"logging": true
}
Synology command options
echo 1 >/dev/ttyS1
echo 1 = Power Off,
echo 0 = Button power,
echo C = Reset.