Getting SSH and SCP Back to Work on Synology DSM 7.x
A few weeks ago, I upgraded my Synology DiskStation to the newest version of the DSM 7.2 branch. The upgrade warned about a few incompatibilities, but I used none of them – at least I thought. While the upgrade went through without any problems, it took a while to notice an odd new problem. When I tried to log in via SSH, all I got was the access denied message.
Strange, then the Passwordless Backup with Synology DiskStation worked as it did before, yet I could not connect with the same credentials.
Fix the SSH login
Synology changed the rules on who can access the DiskStation with SSH between the main DSM versions. For 7.2 we need to put the account we want to login with into the Administrators group. Something I did not like, but as far as I can tell, that way works and there is not much else we can do.
Turn off the banner at the login
When I log into the DiskStation, I got this message that is usually a helpful reminder but may interfere with the SCP command to transfer files:
Using terminal commands to modify system configs, execute external binary files, add files, or install unauthorized third-party apps may lead to system damages or unexpected behavior, or cause data loss. Make sure you are aware of the consequences of each command and proceed at your own risk.
Warning: Data should only be stored in shared folders. Data stored elsewhere may be deleted when the system is updated/restarted.
You can find this text inside /etc/motd. To turn it off, we best use the sudo command to get additional rights and then delete the content of the file – but let the file where it is. If this file is empty, no login banner will show up.
Fix SCP
I could now use SSH to log in into the DiskStation, but I still could not use SCP to transfer files to the DiskStation. The final puzzle piece was the -O option (the big letter o and not a zero) activates the legacy SCP protocol that does not need SFTP.
This additional option got me finally to the point where I can transfer files to my DiskStation.
Conclusion
After those three fixes I got SCP back to work and can now log into my DiskStation with SSH. I hope there will soon be an alternative way than to put the user into the Administrator group with all its additional rights. But until then, that way works.