SSH without password on Synology DSM6.x

1 – Introduction

local user name: cesare

local machine name: desktop.lan

remote user name: admin

remote machine name (Synology NAS): syno.lan

We want cesare@desktop.lan able to connect to admin@syno.lan through SSH without password.

2 – Enable Home service on Synology

Connect to http://syno.lan and check on webUI:

Control Panel => User => Advanced => User Home

“Enable user home service” must be enabled

3- Enable SSH service on Synology NAS

Control Panel => Advanced Mode => Terminal & SNMP

“Enable SSH service” must be enabled

4- Generate ssh key

On our local machine cesare@desktop.lan (the client) we generate the SSH key:

syntax: ssh-keygen -t <key-type> -f <path-to-file> -C “<login>@<host-ip>”

desktop.lan$ cd

if directory .ssh doesn’t exist create it:

desktop.lan$ mkdir .ssh
desktop.lan$ ssh-keygen -t ed25519 -f .ssh/id_syno -C “cesare@desktop.lan”

The switch -C add the “localusername@localaddress” comment in the key content. This can be useful later because we can easily recognize to whom the key belongs to when viewing the file authorized_keys.
This command will ask for a passphrase, for simplicity leave it blank (press enter).

5- Move the public key to the Synology server

Transfer .ssh/id_syno.pub into the ssh folder on admin@syno.lan

syntax: ssh-copy-id -i <public-sshkey> <login>@<host-ip>

ssh-copy-id -i .ssh/id_syno.pub admin@syno.lan
6- Change the permissions on the remote shell
desktop.lan$ ssh admin@syno.lan

The password this time will be asked.

admin@syno.lan$ chmod 644 .ssh/authorized_keys
admin@syno.lan$ chmod700 .ssh
admin@syno.lan$ chmod 755 /var/services/homes/admin
admin@syno.lan$ exit
7- It’s time to reconnect without password
desktop.lan$ ssh -i .ssh/syno_id admin@syno.lan
8- If any problem

If any issues with ssh command just add the -v option. From ssh manual:

-v Verbose mode. Causes ssh to print debugging messages about its progress. This is helpful in debugging connection, authentication, and configuration problems. Multiple -v options increase the verbosity. The maximum is 3.

No Comments

No comments yet.

RSS feed for comments on this post.

Leave a comment

WordPress Themes