Hacking an HP Media Vault Pro for RSYNC

OpenSSH
Image via Wikipedia

I have a number of HP Media Vault Pro, MV5150s, which I purchased to provide classroom storage at a low cost.  These are MV2, Series 2 Media Vault servers, and the instructions that follow are specific to this series only.  They work great, and I have begun to use them daily with all my classes.  Out of the box they don’t support using rsync and that is one of my critical needs for a variety of functions.

If you can’t open it, you don’t own it.  And it was my first opportunity is a great while to see what embedded Linux systems are about in recent times.  So time to hack.

To start hacking a Media Vault means starting with Lee Devlin’s great website http://www.k0lee.com/hpmediavault/.  It is a great respository for the HP Media Vault community and Lee led me to the two User Support Groups on Yahoo!:

User Support Group

There is an 3300+ member Media Vault user group at Yahoo set up specifically to discuss the HP Media Vault and share information with other users.    You can join the group and ask questions or search its archive of more than 8500 messages if you want to learn more about the HP Media Vault or can’t find the answer to your question in this FAQ.    For hacking purposes, there is another group called Hacking the HP Mediavault.

And both of these led me to installing the ipkg packager.  These instructions work fine:

Download ipkginstall.zip

1. Extract the file.
2. Copy the file (ipkginstall.sh) and the dir (ipkgsetup) to a share on the Media Vault
3. SSH in, and cp the file, and dir to “/”
4. # sh ./ipkginstall.sh

Ipkg is now installed in /opt/bin and I modified /etc/profile to include that in the path.

Then one simply runs “ipkg update” to install the file database and “ipkg install rsync” to install the new version of rsync.  Ipkg installs rsync in /opt/bin and to make it work with remote rsync hosts I added a symbolic link in /sbin to /opt/bin/rsync.

The HP MV2 series uses Busybox linux.  Busybox comes with Dropbear SSH which is compatible with OpenSSH ~/.ssh/authorized_keys public key authentication, so use these simple instructions from Mathias Kettner

SSH login without password

Your aim

You want to use Linux and OpenSSH to automize your tasks. Therefore you need an automatic login from host A / user a to Host B / user b. You don’t want to enter any passwords, because you want to call ssh from a within a shell script.

How to do it

First log in on A as user a and generate a pair of authentication keys. Do not enter a passphrase:

a@A:~> ssh-keygen -t rsa
Generating public/private rsa key pair.
Enter file in which to save the key (/home/a/.ssh/id_rsa):
Created directory ‘/home/a/.ssh’.
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/a/.ssh/id_rsa.
Your public key has been saved in /home/a/.ssh/id_rsa.pub.
The key fingerprint is:
3e:4f:05:79:3a:9f:96:7c:3b:ad:e9:58:37:bc:37:e4 a@A

Now use ssh to create a directory ~/.ssh as user b on B. (The directory may already exist, which is fine):

a@A:~> ssh b@B mkdir -p .ssh
b@B’s password:

Finally append a’s new public key to b@B:.ssh/authorized_keys and enter b’s password one last time:

a@A:~> cat .ssh/id_rsa.pub | ssh b@B ‘cat >> .ssh/authorized_keys’
b@B’s password:

From now on you can log into B as b from A as a without password:

a@A:~> ssh b@B hostname
B

And that was all there is to it.  Follow the caveats.  Know your abilities.  As always your mileage may vary.