Sunday, June 14, 2009

Adventures with WD MyBook as a Linux Server

I've been looking for a small Linux server with a large disk that I could put at my in-laws' house to use as off-site backup for my data. Thursday I read about a hack to use the Western Digital MyBook World Edition (with Ethernet) as a Linux server and went right out and bought one.

My first surprise came when I discovered the hack was no longer necessary on the latest version of the disk -- you could simply turn on SSH access from their configuration software! The downside for this is most of the online advice for using the MyBook as a Linux server assumes you have no older version, and no longer applies to the new code. So there has been lots of feeling my way around blind.

The default setup for a normal user share (instead of root) is a bit weird -- though it creates a home directory for you, it's not the user's actual home directory. Hand-editing the passwd file fixed this. Plus chown-ing the directory so I owned it, and chmod-ing it to 744. Then it was easy enough to add a .ssh directory with an authorized_keys2 file.

Unfortunately, my first attempt to lockdown the machine so you can't use plain passwords to SSH locked up the SSH quite thoroughly, and I could no longer log in. After some frustrating poking at it, I reset the machine to factory defaults so that I could get back into it. (It's possible I should have tried rebooting the machine at this point -- see below.)

And that's where things get really weird. Because it did delete my user id and reset things so I could log in again. But it didn't actually restore the machine to the way it shipped -- the root directory still had the .ssh and authorized keys I had added to it, and the etc directory still had my modified ssh_config file. The authorized keys was definitely working, but the ssh_config file appeared to be ignored -- at least, it let me use a password to log into my user account (once it was recreated). So weirdly enough, it was sort of magically doing exactly what I needed to get it going again, without undoing all the work I had done.

This time I think I'll follow the advice to turn on telnet as an alternative to SSH, at least until I've got the SSH configuration worked out just the way I'd like it...


  1. Huh. Neither of two different copies I made of ssh_config I made appear to be in use at the moment... but there is now an sshd_config file I don't remember being there previously.

  2. And changing the sshd_config file got just the configuration I wanted. Yay!