How to enable passwordless SSH login to a Synology NAS

From steamWiki
Jump to: navigation, search

Several things need to be done to allow passwordless SSHing into a Synology NAS box. This guide was written against DSM 6.2.1-23824 Update 1.

  1. Enable support for SSH on the Synology target machine
    1. Click the Control Panel Icon
    2. Choose Terminal & SNMP
    3. Check Enable SSH service
  2. Allow the user, on the Synology target machine, to SSH
    1. Edit /etc/passwd
    2. Change the command/shell of the user that will SSH into the box from /sbin/nologin to /bin/sh
    • Read this to understand the format of the /etc/passwd file a bit better.
  3. Add the authorized key of the client to the authorized_keys file of target
    1. on the client run ssh-keygen
    2. copy the .pub file (likely something like /home/user/.ssh/ to the target machine with a command like
      scp /home/user/.ssh/ target_user@target_server:/var/services/homes/target_user/.ssh/
    3. either rename to authorized_keys or copy the contents into your authorized_keys file.
  4. SSH once manually from the client machine (as the SSHing client user) to the target machine to add the target machine to the client's known_hosts file.