Buffalo NAS-Central Forums

Welcome to the Linkstation Wiki community
It is currently Sat Mar 25, 2017 12:42 pm

All times are UTC+01:00




Post new topic  Reply to topic  [ 3 posts ] 
Author Message
 Post subject: How to replace hddroots?
PostPosted: Tue Oct 29, 2013 2:11 pm 
Offline
Total Newbie

Joined: Tue Oct 29, 2013 1:53 pm
Posts: 4
Hey there,

I'm currently trying to modify the 1.65 hddrootfs such that I can root@ssh into my LS-WVL directly after "updating" the firmware. While the modified hddrootfs.img seems fine (I also tried an unzipped hddrootfs.buffalo.updated with the respective linkstation_version.ini/txt changes), the LinkStation reboots after receiving the firmware but then seems to notice my modifications and restores the previous firmware installed.

Is there any way to turn this off, or did I do something else wrong?

Here's my patching script FYI:

Code:
#!/bin/bash

set -e

PASSWORD="..."
HDFILE="hddrootfs.buffalo.updated"
ZIPFILE="../hddrootfs.img"

mkdir modded
cd modded
chmod ugo-s .

echo "Extracting $ZIPFILE"
7z e -P$PASSWORD $ZIPFILE

echo "Extracting hddrootfs"
mv $HDFILE $HDFILE.tgz
mkdir hddrootfs
cd hddrootfs
tar xf ../$HDFILE.tgz
rm ../$HDFILE.tgz

echo "Changing root's password to \"password\""
sed -i 's/^root:.*/root:$1$$I2o9Z7NcvQAKp7wyCTlia0:11009:0:99999:7:::/' etc/shadow

echo "Enabling root SSH access via password"
echo "Removing old entries"
sed -i '/UsePAM/d' etc/sshd_config
sed -i '/PermitRootLogin/d' etc/sshd_config
sed -i '/PasswordAuthentication/d' etc/sshd_config
echo "Appending new entries"
cat >> etc/sshd_config <<EOF

# Enabling SSH for root
UsePAM no
PermitRootLogin yes
PasswordAuthentication yes
EOF


echo "Repacking $HDFILE"
tar czf ../$HDFILE *
cd ..

#7z a -P$PASSWORD $ZIPFILE.new $HDFILE
#rm $HDFILE


Also, even after manually applying these changes via acp_commander, I still can only log in via password (so actually the patch should modify /etc/shadow as well) and not via public key, which worked fine back in 1.60 - did Buffalo somehow disable that or did I miss something in my modification this time?


Last edited by zommuter on Thu Oct 31, 2013 10:43 am, edited 2 times in total.

Top
   
PostPosted: Tue Oct 29, 2013 7:02 pm 
Offline
Regular Member

Joined: Sat Nov 11, 2006 10:56 am
Posts: 714
There's no restoring of the firmware

Just push your modified image with lsupdater

Just force flash the rootfs

then if you did things correct it will boot up or not


Top
   
PostPosted: Wed Oct 30, 2013 6:13 pm 
Offline
Total Newbie

Joined: Tue Oct 29, 2013 1:53 pm
Posts: 4
Thanks for your reply, Shonk.

For some reason
Code:
tar --delete
didn't work, which probably caused the LinkStation's updater to fail and revert the firmware. I modified my script to recreate the archive from scratch and now it works perfectly fine.


Top
   
Display posts from previous:  Sort by  
Post new topic  Reply to topic  [ 3 posts ] 

All times are UTC+01:00


Who is online

Users browsing this forum: No registered users and 7 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Limited