Enable SSH, SCP/SFTP and configure a static IP address on your Synology NAS

In this post, I'll walk you through the steps I followed when enabling SSH, SCP/SFTP and configuring a static IP address on my Synology NAS.

Enabling Services

Login to the Synology DiskStation Manager (DSM) from your web browser (you can find the IP address on your router's status page):

http://<IP-ADDRESS>:5000/

And, navigate to the Control Panel:

Enable SSH

Click on 'Terminal & SNMP' and check the box next to Enable SSH service:

Enable SCP/SFTP

In the Control Panel click on 'File Services' then click the 'FTP' tab and check the box next to Enable SFTP service:

Enable the User Home Service

When remoting (SSHing) into your NAS, you might see a warning message like the following:

Could not chdir to home directory /var/services/homes/rob: No such file or directory

To prevent this error, you need to enable the User Home Service.

In the Control Panel click 'User' then click the 'Advanced' tab and check the box next to Enable user home service:

Configure a static IP address

In the Control Panel click on 'Network' then click the 'Network Interface' tab, select 'LAN' and check the box next to Use manual configuration:

Now, we can update the hosts file (on the computer you wish to log in from):

sudo nano /etc/hosts

as follows:

...
192.168.1.100 nas-1
...

And, update the SSH configuration file:

sudo nano ~/.ssh/config

as follows:

...
Host nas
     HostName nas-1
     Port     22
     User     rob
...

To test the new settings, open a terminal window and login:

ssh nas

We can setup SSH passwordless authentication by copying the public key (on the computer you wish to log in from) to the remote host:

ssh-copy-id -i ~/.ssh/id_rsa.pub -p <PORT> rob@nas-1

I also had to fix the default permissions on the NAS user's (rob) home directories:

sudo chmod 755 /var/services/homes/rob
sudo chmod 700 /var/services/homes/rob/.ssh
sudo chmod 644 /var/services/homes/rob/.ssh/authorized_keys

To test the new settings, open a terminal window and login:

ssh nas

Shutdown your NAS

You can shutdown your NAS by pressing and holding the power button (on the front panel) until you hear a beep sound. You can also shutdown your NAS by selecting the 'Shutdown' option on the Synology DiskStation Manager's 'Options' menu.

References: