Installing rsync and Unison on the Buffalo TeraStation Live
just bought a 2TB Buffalo TeraStation NAS and I love the thing. It is silent, fast and highly configurable/hackable whichever you prefer.
There is a good reference community about hacking the TeraStation, and most of the information presented here is just a compilation of several different articles, and forum posts found around the site. So I wish to acknowledge all the people that have contributed to uncover the mysteries of the Buffalo NAS units.
Getting Telnet and SSH
The first step is to get the telnet daemon running. The factory firmware includes a telnet daemon so we do not need to change it. Just download the acp_commander tool and run
java -jar acp_commander -t <ip address> -o
In my case the IP address of my TeraStation is 192.168.1.20 so I ran:
java -jar acp_commander -t 192.168.1.20 -o
You should then see something like
ACP_commander out of the linkstationwiki.net project.
Used to send ACP-commands to Buffalo linkstation(R) LS-PRO.
WARNING: This is experimental software that might brick your linkstation!
Using random connID value = 07CAA8F945F3
Using target: raid/192.168.1.9
Authenticate: OK (ACP_STATE_FAILURE)
Installing addons.tar …
creating directory… OK
Didn’t find locally, looking at
java.io.FileNotFoundException: /192.168.1.9/share/acp_commander/addons.tar (No such file or directory)
at java.io.FileOutputStream.open(Native Method)
start telnetd… OK (ACP_STATE_OK)
Reset root pwd… Password changed.
after which you can telnet to your box with user root and no password by doing
Once you’re please run passwd to set the root password. Now you should enable SSH so you can safely connect to the TeraStation. To do so follow the complete instructions on enabling SSH. Although my firmware is verson 2.14 I used the “1.11-1a Firmware” scripts and they worked perfectly.
At this point you should have a running SSH daemon in your TeraStation so it is time to start the heavier lifting.
Enable Key Based SSH Authentication
On the computer you which to initiate your SSH connections to the TeraStation run
ssh-keygen -t rsa
ssh-copy-id -i ~/.ssh/id_rsa.pub firstname.lastname@example.org
This will enable key based authentication for user root in your TeraStation. If you want to enable the same type of authentication for other TeraStation users you need to repeat the ssh-copy-id command for each one. Then you must disable StrictMode on the TeraStation’s SSH daemon (StrictMode no in /etc/sshd_conf) due to the permissions on the TeraStation’s /home directory. Then restart your TeraStation SSH daemon with
If you generate your RSA keys with no password you will not need to type a password to login to your TeraStation via SSH from the authorized users/host.
Accessing your file Shares from SSH
All you configured shares are accessible from command line in the /mnt/array1/<sharename>, you can use them to copy any needed files during the hacking process.
The stock firmware also includes rsync so all you really need to do is enable it.
One thing to keep in mind is that the TeraStation recreates some of its files after booting so you need to change one script to make changes permanent, one option is listed in the FAQ, but I ended up not using it.
I ended up changing the file /usr/local/bin/mkrsconf.pl in order for it to create the proper /etc/rsync.conf as well as the /etc/hosts.allow. So download my version of the mkrscon.pl script and copy it to one of your TeraStation shares, then via ssh run the following
cp /usr/local/bin/mkrsconf.pl /usr/local/bin/mkrsconf.pl.bak
cp /mnt/array1/<share>/mkrsconf.pl /usr/local/bin
to make sure it worked check if the file /etc/hosts.allow exists.
Now you should be able to use rsync to your TeraStation.
Rsync is a great backup utility but it is a one way tool, it will not do bi-directional sync so I opted to install Unisson, which is a fast and stable sync tool.
I have several computers that I use daily and I need to have them synced all the time. To make things a bit harder they all have different OSes. I use an iMac with Leopard, a PC with Windows XP and a laptop with Ubuntu. All my documents are synced up to the TeraStation and down to each machine flawlessly using unison and some scripts.
The challenge in getting Unison on the TeraStation is that you’ll need to compile it, and that was not as easy as it seemed at first.
Follow the instructions on to install PKGSRC Arm tools so you can compile natively in the TeraStation Live.
At the time of this writing the OCAML stable version was 3.10.2, but I ran into compilation problems that I could not resolve so I tried version 3.09.3 and it compiled just fine after creating the opnames.ml file as explained bellow.
tar zxf ocaml-3.09.3.tar.gz
While compiling the ocamtools I got an error while compiling, specifically: Unbound Value “name_of_insrtuctions” : Error 2
This has to do with an error in the make file in the tools directory to generate the opnames.ml ocaml-3.09.3. A sed command in the TeraStation is giving an error so the file is not generated appropriately and stays empty.
For simplicity you can download the correct version of the opnames.ml, and place it in you ocaml-3.09.3/tools directory, then rerun “gmake world”.
Now all you need to do is to compile your unison sources by doing
tar zxf unison-2.27.57.tar.gz
gmake UISTYLE=text NATIVE=false
Even if you get an error about etags not being found during compilation your unision bunary should have been generated. To check run
which should produce
unison version 2.27.57
cp unison /usr/local/bin
ssh email@example.com unison -version
I hope this document helps you out and that by writing it I am giving a little bit back to the community.