July 29, 2014 Leave a comment
I have all my media in Buffalo Linkstation LS-VL pro NAS. This is a marvellous piece of machine which is fast and compact as well. I just thought it would be great to have complete control of this machine and for this I obviously need root access.
Following are the steps for Mac OS and Linux through which I gained full access.
1. Download acp_commander.jar file from buffalo to your desktop.
2. Now open Terminal and type the following command
Above command will ask you to enter the file name. I prefer to save it to desktop for example in my case it was.
The command will ask for passphrase but you can keep that blank if you want.Now it will generate two files authorized_keys and authorized_keys.pub. These two files are the public and private key for SSH login.
3. Now generate a TXT file named open-ls.txt on your desktop with the following lines.
# open-ls.txt -- This script will be executed on the LS
# DIR is where we are
DIR=$( cd $(dirname $0) ; pwd)
# Create the directory for the ssh keys and copy the pubkey there
chmod 700 /root/.ssh
cp $DIR/authorized_keys /root/.ssh/
chmod 600 /root/.ssh/authorized_keys
# Required if 'authorized_keys' have een written on a Windows PC
### Enable root login for SSH
# Backup sshd_config
cp -p /etc/sshd_config /etc/sshd_config.orig
# Replace all "PermitRootLogin no" by "PermitRootLogin yes"
sed -i '/PermitRootLogin/s/no/yes/' /etc/sshd_config
chmod 600 /etc/sshd_config
grep PermitRootLogin /etc/sshd_config
# Last we restart the sshd.
4. Now by default Linkstation has a folder named share with all you media inside. In this folder upload open-ls.txt and authorized_keys.pub but rename it to authorized_keys.
5. You must be now left with acp_commander.jar and authorized_keys private key on Desktop. Using terminal go to your desktop directory and type the following command.
mv authorized_keys ~/.ssh/id_rsa
Your private ssh key should be renamed in id_rsa and kept inside hidden .ssh folder.
Now type the following command.
java -jar acp_commander.jar -t LINKSTATION_IP -ip LINKSTATION_IP -pw LINKSTATION_WEB_ADMIN_PASSWORD -c 'ls /mnt/disk1/share/'
After the above command gets executed type the following command.
java -jar acp_commander.jar -t LINKSTATION_IP -ip LINKSTATION_IP -pw LINKSTATION_WEB_ADMIN_PASSWORD -c 'sh -x /mnt/disk1/share/open-ls.txt'
If the above command gets executed successfully then you would be able to login as root using ssh to your link station.
If you have tried to login prior to this guide then you may need to delete know_hosts inside your .ssh folder.
You can now enjoy the full control on your linkstation.
For reference please visit buffalo wiki.