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.
- 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.
- Start WinSCP. You will get a Window as shown below
- Select New Site on the left hand part of the WinSCP login screen.
- You are now able to enter the connection data. Select SCP as File protocol.
- Enter the IP address or the host name from your DiskStation.
- 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.)
- 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.)
- Click the Save As… button
- Give the site a name or accept the default and click the OK button.
- Select the just created site (firstname.lastname@example.org) on the left side of the Window and click the Login button.
- 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.)
- 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:
- 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: