Tag Archives: SSH

Home / SSH
2 Posts

Warning!
This post is about accessing and modifying the core files of your DiskStation. You must be absolutely sure what you are doing. Faulty modifications made on this level can result in a DiskStation that doesn’t work anymore and/or in DATA LOSS! If you doubt about your skills on this level, then don’t execute the steps described below on your DiskStation. You are being warned!

Sometimes the DiskStations desktop isn’t enough to manage your DiskStation. You have to have access to the system’s complete filesystem. The FileStation can’t help you out anymore. If you have a Windows computer then the best way to do this is using Putty. Many tasks can be done with WinSCP. but not for all tasks. There is a post about WinSCP here. However for some tasks you just need a terminal client, and there is where Putty fits in perfectly. Putty is freeware an can be downloaded at http://www.putty.org. Get yourself a copy there and install Putty.

Before you can use Telnet or SSH on your DiskStation, you have to enable it first. This must be done in the DiskStations desktop:

  1. Login to your DiskStations DSM as an Administrator
  2. Open Control Panel
  3. Click Terminal & SMTP
  4. Tick the Enable SSH Service (More secure than Telnet)
  5. Click Apply
  6. Close Control Panel
  7. Log off DSM

For security reasons you might want to turn this option off when you are done with Putty.

Now it is time to start Putty:

  1. Start Putty.
  2. Enter the IP address of your DiskStation (or it’s host name).
  3. Select SSH.
  4. Give the session a name. (For the next time you want to use Putty to access your DiskStation.)
  5. Click the Save button.
  6. Click the Open button.
  7. Enter root as login name in the terminal session
  8. Enter your Admin accounts password
  9. Now you are in your DiskStations on terminal level.

putty

Warning!
This post is about accessing and modifying the core files of your DiskStation. You must be absolutely sure what you are doing. Faulty modifications made on this level can result in a DiskStation that doesn’t work anymore and/or in DATA LOSS! If you doubt about your skills on this level, then don’t execute the steps described below on your DiskStation. You are being warned!

I often read in forums that users don’t know how to handle the cli of the DiskStation. The figured out that the can access the console by telnet or, preferably, Secure Shell (SSH). But when it comes to editing a configuration file, the problems begin. Real die hards are using vi on the console of their DiskStation by using Putty. Vi will fulfil all your editing needs on practically any *nix platform. It is always available. It has only one drawback: It isn’t quiet intuitive. There is where the problems begin for not so experienced users.

The alternative is installing another editor or a tool with an editor on your DiskStation (Midnight Commander has build in editing capabilities. It can be installed by adding the repository of the SynoCommunity to your Package Center and install Midnight Commander package from the Community section in the Package Center. See also: http://www.wijngaard.org/synology-3th-party-package-sources/)

Another way is to copy the file for editing to your local machine, do the editing, and copy it back. Particularly Windows users may run into the next pitfall: they use the default Notepad. Notepad saves the text files in a slightly different format. This format isn’t usable on *nix machines. Many times people wonder why some configuration doesn’t work while the have make the correct changes to the configuration file. Most of the time the reason for this is that they used Notepad from Windows. You can install a real text editor on your Windows machine. A good one is Notepad++. (Even if you don’t intend to edit your DiskStations configuration files, it’s a good idea to install Notepad++.)

You can keep copying files from and to your DiskStation. You also can use a program that eliminates the need for Putty (Console) in almost 95% of the time and has a file explorer and a text editor too: WinSCP. WinSCP is free and can be downloaded from http://winscp.net/eng/download.php in a zip archive or with an installer. Download it and install it on your Windows computer. The next paragraph will describe what to do to make it work.

  1. Enable the possibility to use SSH on your DiskStation if you didn’t already. Login on DSM and go to Control Panel > Terminal. Enable the SSH Service by checking the box before ‘Enable SSH service’ and clicking the ‘Apply’ button. If you use the DiskStations firewall, make sure it allows TCP traffic on port 22 from your local network. You can close the DSM.
  2. Start WinSCP. You will get a Window as shown below
  3. Select New Site on the left hand part of the WinSCP login screen.
  4. You are now able to enter the connection data. Select SCP as File protocol.
  5. Enter the IP address or the host name from your DiskStation.
  6. use root as User name and enter the password of your DiskStations real Admin account if you want to (Not recommended). (The default Admin. Not a new account on your DiskStation that is assingned to the adminisrators group.)
  7. If your DiskStation runs DSM 5.1, you have to alter the shell to use. Click the Advanced… button and select advanced… again. Then `select under Environment the item SCP/Shell. Type in the Shell field: /bin/sh. Then click teh OK button to confirm. (The popped up Window closes.)
  8. Click the Save As… button
  9. Give the site a name or accept the default and click the OK button.
  10. Select the just created site (root@192.168.1.2) on the left side of the Window and click the Login button.
  11. For WinSCP this is an unknown server. Accept the rsa-key to confirm you trust this server by clicking the Yes button. (This happens only the first time.)
  12. If you haven’t saved a password for this server, then you are asked to enter it now and confirm it with the OK button:
  13. Now you have a file explorer with on the left had side your local computer and on the right had side your DiskStations filesystem. When you right-click on a file, you get the edit option. You even can execute a console command for instance to restart the webserver services:

Now you are able to access your DiskStation by SSH you must make sure that your DiskStation is NOT accessible on port 22 from the internet. It seems useful to be able to access your NAS with SSH remotely, but it also may be vonerable to hack attempts from the internet. If you need to administer your DiskStation remotely over the internet, never make this port available on the internet but consider using a VPN tunnel. Your Synology has a beautiful solution for this: Install and configure the VPN Server package in your Package Center. (http://www.synology.com/en-uk/support/tutorials/459)

Default on a Synology only the Admin account can have Telnet/SSH access to the DiskStation. However it is possible to assign other accounts too. You have to edit the /etc/passwd file. Open this file in your text editor and replace in the users entry the /sbin/nologin with /bin/ash. (Be careful with that!) Save the file and the edited account is now allowed to access you DiskStation with Telnet/SSH.

For those who still want to administer the DiskStation from a terminal console with Putty, I’ve two links that may help you to come allong: