How do I sign in to DSM with RSA key pairs via SSH?

How do I sign in to DSM with RSA key pairs via SSH?

Purpose

This article guides you through connecting to DSM with an RSA key pair either as an administrator or as root via SSH.

Warning:

  • Enabling SSH service may bring security risks to your system. Please enable it only when necessary and avoid making changes to system configurations.

Environment

  • The methods described in this article only apply to DSM 6.2.4 or above.

Resolution

A. Before you start

  1. Sign in to DSM using an account belonging to the administrators group.
  2. Go to Control Panel > Terminal & SNMP > Terminal and tick Enable SSH Service.
  3. To sign in to DSM as an administrator via SSH:
    • Go to Control Panel > User & Group (for DSM 7.0 and above) or User (for DSM 6.2.4) > Advanced > User Home, and tick Enable user home service.
    • Make sure the "homes" shared folder is using the default permissions. Non-admin users should not be granted any Read or Write permissions.

B. Generate an RSA key pair

For Windows 10 or macOS

For Windows 7 or earlier versions

C. Upload the public key to Synology NAS

Sign in as an administrator

Sign in as root

D. Sign in via SSH with an RSA key pair

Use OpenSSH on Windows 10 or macOS

Use PuTTY on Windows 7 or earlier versions

Notes:

  1. The .ssh folder may be hidden on your Mac. Press the combination keys Command (⌘) + Shift (⇧) + Period (.) in Finder to show hidden items.
  2. You'll be prompted to enter a passphrase if you have set it up during the key generation.
  3. "volumeX" means the volume where the file id_rsa.pub is located, e.g., volume1.
Purpose
Environment
Contents
Resolution
A. Before you start
B. Generate an RSA key pair
C. Upload the public key to Synology NAS
D. Sign in via SSH with an RSA key pair