Wednesday, May 15, 2013

Hack Buffalo Pro Duo to use rsync and SSH

Hello world! Recently someone I was doing some work with needed a solution for backups. They wanted to use a external HDD system where one HDD would be active and get nightly backups for a week then they would rotate it out. They got four Buffalo LS Pro Duo 4TB which are great devices. Problem is they have OpenSSH and rsync installed... but they aren't usable. This is no good. I want to have a cron job on the servers simply compress everything, then rsync it to a directory on the Buffalo. So it's hacking time!

First thing you'll need is your buffalo attached to a network. If your like me and happily lack a windows computer you won't be able to use the CD it came with to find it on your network. Just use Fing on your smart phone and scan your network or use your handy dandy MikroTik to scan it. The DNS entry it comes with by default is the model number. Mine showed up on Fing as "LS-WVLC86" and of course had Buffalo next to it. Now you have the IP, mine is At this point you can jump on the webGUI and change it but I want to get SSH and rsync up and running first.

Now assuming you already have java on your computer you'll need to DOWNLOAD ACPCOMMANDER . ACP commander allows you to send a single line command to the Buffalo. Now there's a bunch of guides out there that have a bunch of crazy steps with PHP and sillyness, ignore that crap. All you need to do it do the following:

Change root password:

java -jar acp_commander.jar -t -ip -pw adminpasswordhere -c "(echo newrootpass;echo newrootpass)|passwd"

Allow root to login on ssh:

 java -jar acp_commander.jar -t -ip -pw adminpasswordhere -c "sed -i 's/UsePAM yes/UsePAM no/g' /etc/sshd_config"

java -jar acp_commander.jar -t -ip -pw adminpasswordhere -c "sed -i 's/PermitRootLogin no/PermitRootLogin yes/g' /etc/sshd_config"

Restart ssh service:

java -jar acp_commander.jar -t -ip -pw adminpasswordhere -c "/etc/init.d/ restart"

(Shout out to Matt Wells for forcing me to learn sed and awk)

Well that's really it,  open a terminal and ssh away! Also note that this is persistent through reboots. 

Now set up public/private key authentication. ( Guide ) Once you have that done just up a .ssh/config file and you can back everything up.