DiskStation: fix ipkg and SSH after upgrade

For about half a year now I own a Synology DiskStation DS412+, which is a wonderful 4-bay NAS. I fitted it with 4 3TB Seagate drives for a grand total of 12 TB of storage. Later I will document how I store my data and especially what and how I backup.

Now I want to note the steps I have to take after updating the DSM software of the box to get things back to normal. Because the same two things always break:

  1. Lost access to ipkg packages
  2. Password authentication gets re-enabled for SSH access

Fixing ipkg

MissileHugger is the most appreciated source of the next instructions, but since I am terrible with vi, I augmented them a bit. And the worst about ipkg not working is that nano is not available 🙁

Steps:

$ vi /root/.profile

Press “i” in vi to start editing

Add /opt/bin:/opt/sbin: at the start of PATH

Press ESC to stop editing.
Type “:x” to save the file and exit vi.

Then:

$ /etc/rc.local
$ . .profile

Nano should work now, if not reboot

Disable password authentication in SSH

The second side effect of a DSM upgrade is the re-enabling of password authentication in the SSH server. Like my VPS I have configured SSH to only allow access using public key authentication. For that I specifically disabled password authentication, but alas, that gets enabled again.

But now that nano works again (yay!) let’s use it:

nano /etc/ssh/sshd_config

Change:
#PasswordAuthentication yes to
PasswordAuthentication no

Restart the DiskStation. All should be fine again … until the next DSM upgrade.

To test if password authentication works I keep a special configuration in PuTTY to connect to the DiskStation without a private key. I use that to check after an upgrade.

Links


Leave a Reply

Your email address will not be published. Required fields are marked *