Enabling the Command Line Interface

From SynologyWiki
Jump to: navigation, search

This document will guide the user in enabling the Command Line Interface (CLI) of the Synology System. The CLI is a Linux-based Shell, where users who are familiar with this interface can perform management and manipulation of the Synology System.
Please note that improper manipulation or modification of the Synology server may result in machine malfunction or loss of data.
Please read the General Disclaimer before modifying the Synology product.

This guide will cover two different protocols of accessing the same CLI, Telnet and SSH.

Enabling the Command Line Interface

This guide was written for Synology Disk Station Manager DSM2.0-0640 and above.

Step 1:

Begin by logging into the Synology Disk Station Manager using the Administration account.


Step 2:

Enable the CLI as follows

  • A) Open the Terminal Services Menu, from the Network Services Folder
  • B) Enable the Telnet or SSH Service, if you are unsure which to use please see the section "Which Should I Use, SSH or Telnet"
  • C) Click OK to confirm this operation

Step 3:

Check Firewall Setting (if firewall is being used)

  • A) Open the Firewall Menu, from the Network Services Folder
  • B) Double click enabled rule
  • C) In Ports Section, press Select button next to Select from a list of built-in applications
  • D) Make sure Ports 22 - SSH or 23 - Telnet are enabled
  • E) Click OK twice and then Save to confirm this operation

Service Specifications

  • Port Numbers:
    • Telnet: 23
    • SSH: 22
  • (Default) Login Accounts: root, admin
  • Password: Same as the administrative password of the Synology System
    • Note: Login will fail if password is blank/empty
  • If you want to login as another user (which for command line management makes good sense -- root is root and admin is the pgsql login which is needed at boot prior to optware initialisation to start pgsql up) then
    • Add the user using the DSM management page (the user needs a password in /etc/shadow)
    • ssh into the device as root
    • Edit /etc/passwd for the user so that their home path exists (e.g. /opt/home/username)
    • Edit /etc/passwd for the user to change their shell to /bin/ash .
      • NOTE: If you want to use bash (/opt/bin/bash - an extra ipkg package) instead of /bin/ash it fails for an unknown reason. Place the following in your users .profile directory to enable bash:
if [ -x /opt/bin/bash ]; then
 exec /opt/bin/bash
    • Test new user ssh login
    • Note the default /etc/profile hardwires $HOME to /root, you probably want to change that

How to access the CLI

A terminal client must be used to access the CLI, such as Windows Telnet Service, or Putty for SSH clients.

For Telnet

Step 1:

  • Launch the Terminal Application
    • For Windows Users, go to [Start] -> [Run] and type without quotes "telnet synologyServerName" where "synologyServerName" is the name of the Synology product
      • Default names are: "diskstation" , "cubestation" , "rackstation"
    • synologyServerName can also be replaced with the IP address of the Synology product, for example "telnet"

Step 2:

  • Login using the credentials listed under "Service Specifications"

For putty (SSH)

Step 1:

Download and install Putty if you do not already have a SSH client.

Step 2:

Configure your SSH client with the correct paramters for connecting to your Synology Server. If you are using putty these are: Under "Host Name (or IP address)" enter your synology Servers IP address or server name, ensure "Port" is set to 22, ensure "Connection type" is set to SSH. If you want you can save this configuration by entering a description in the "Saved Sessions" dialogue box and click the Save button.

Step 3:

Start the SSH session, in putty click the "Open" button, or if you saved the configuration, double click on its name in the "Saved Sessions" list. A shell window will open and if it connects to the synology server a prompt will appear asking you to login. Login using the credentials listed under "Service Specifications". If putty could not connect to the Synology Server a blank window will open and after 1 minute a "Network Error: Connection timed out" message will appear. If this happens repeat the steps in this wiki carefully.

The Busybox

When you access the CLI (by Telnet or SSH) you are provided the same CLI provided by a small command interpreter called "Busybox" from BusyBox Origin with a few commands. An almost endless list of publicly accessible wikis discusses the features. I thus rather suggest a google search on BusyBox instead of copying content.

Personal tools
Community Resources