Tuesday, April 2, 2013

NAS disabling sshd on a reboot

Having got SSHD configured on my D-link DNS-320 NAS successfully (and outlining the process in my last post) the setup has somehow reset itself. This is behaviour I thought I'd seen before a while back, but had put it down to a slip up on my part. Delving further it turns out this isn't just affecting SSHD - I installed an SVN server on the NAS the other day and the SVN daemon config files have also mysteriously reverted to their default contents (and possibly permissions).

With the kid in bed and the baby drifting off with a bottle (held by wife) I decided I'd sit down and try to crack this nut. Taking stock first, it turns out that the permissions on the following files have reverted to the fun_plug defaults:

/ffp/home/root directory (permissions should be 755)
/ffp/home/root/.ssh directory (should be 700)
/ffp/home/root/.ssh/authorized_keys (should be 600)
/ffp/etc/ssh/* contents (should be 600)
/ffp/var/lib/sshd (700 will do)

After setting these all to the right perms I rebooted the NAS (using the 'reboot' command from a telnet session). Lo and behold, I can subsequently no longer establish a SSH session to the NAS.

/ffp/home/root has reverted to 777
/ffp/home/root/.ssh has reverted to 722
/ffp/home/root/.ssh/authorized_keys has reverted to 622
/ffp/etc/ssh/* has reverted to 622
/ffp/var/lib/sshd has reverted to 622

So there are the symptoms. Question is, what's the cause? It sounds like it might be down to a feature of the D-Link firmware. I can understand how brute-force setting of permissions might help keep the system stable for non-fun_plug users, but what a bummer for me. Now trying to reset the NAS to factory settings... no improvement. I give in.

No comments:

Post a Comment