Buffalo NAS-Central Forums

Welcome to the Linkstation Wiki community
It is currently Wed Jan 17, 2018 2:09 pm

All times are UTC+01:00




Post new topic  Reply to topic  [ 1 post ] 
Author Message
PostPosted: Mon Sep 29, 2008 8:17 pm 
Offline
Newbie
User avatar

Joined: Sat Jun 21, 2008 3:52 pm
Posts: 12
Hi. I recently updated the my LS2 MIPSEL HD-H250LAN from the DropBear SSH to the OpenSSH 4.3p2 mentioned in the wiki. I took some notes for areas where the "generic instructions" missed or were missing.

// STARTING POINT
http://buffalo.nas-central.org/index.php?title=OpenSSH_(including_daemon)_for_the_PPC_LinkStation#OpenLink_.28MIPSel.29

This is the "root" wiki page and my starting point.

// ENABLE TELNET DAEMON
http://buffalo.nas-central.org/index.php/The_LinkStation_firmware_flasher#6B_-_Configuring_utelnetd_with_OpenLink

If not already enabled, get the telnet daemon working as per the url above. You'll need backup access to the device in case (as I did) something with the ssh configuration doesn't work correctly.

0) set root password (if unset/unknown)
passwd root
1) enable telnet server (as documented in url above)
2) secure to password for telnet access (as documented in url above)

// FIX MISSING SORT (LINK)
http://buffalo.nas-central.org/index.php/DevelopmentToolsInstallation#MIPSel_.28LS2.29

While the wiki link above said this might be missing the "sort" command, the link for resolution was dead. This is how I fixed it:

cd /bin
ln -s busybox sort


// SCRIPT NOT USABLE ON REBOOT
http://buffalo.nas-central.org/index.php?title=OpenSSH_(including_daemon)_for_the_PPC_LinkStation#OpenLink_.28MIPSel.29

The "generic script" provided in the link above did not function after rebooting the device:

Problem 1: su may not work correctly (based on results, not knowledge)
Solution 1.1: remove su comments
Solution 1.2: Added root checking at beginning of script
Solution 1.3: Converted su commands to start-stop-daemon

Problem 2: restart only stops service, doesn't start it again
Solution 2.1:Converted su comments to start-stop-daemon

Modified script /etc/init.d/sshd I am using:
Code:
#! /bin/sh
export USER="root"
NAME=sshd

if [ `whoami` != root ]; then
  echo "Not root. Action refused.";
  exit -1;
fi

if [ `id -u` != 0 ]; then
  echo "Not root. Action refused.";
  exit -1;
fi

start()
{
  if [ ! -d /var/empty ]; then
     mkdir /var/empty
  fi
  start-stop-daemon --start --quiet --exec /usr/local/sbin/sshd 
}
stop()
{
  start-stop-daemon --stop --quiet --exec /usr/local/sbin/sshd
}
restart()
{
  stop
  start
}
case "$1" in
    start)
       echo "Starting sshd: "
       start
       ;;
    stop)
       echo "Stopping sshd "
       stop
       ;;
    restart)
       echo "Restarting sshd "
       restart
       ;;
     *)
      echo "Usage: /etc/init.d/$NAME {start|stop|restart}"
      exit 1
      ;;
esac
exit 0
// MAKE SCRIPT EXECUTABLE (root only)
cd /etc/init.d
chmod 700 sshd


// LOGIN IN TELNET
if you can't log in by telnet, do not proceed! Go back to the start and recheck everything.

// TERMINATE DROPBEAR SSH
You'll need to disable/kill dropbear's ssh (if running) before proceeding.
killall dropbear

// KILL DROPBEAR SSH KEY
Before you can connect with OpenSSH, you need to remove any old SSH key.
cd ~/.ssh
vi known_hosts

find and delete the old host key

// TEST (new) SSHD SCRIPT
Make sure the new script works.
/etc/init.d/sshd
/etc/init.d/sshd start
/etc/init.d/sshd stop
/etc/init.d/sshd restart

// DO YOU THINK EVERYTHING WORKING?
If new script appears to be working AND the telnet is confirmed working, you can prepare to reboot the device after the next step.

// REMOVE DROPBEAR DAEMON
Before you reboot, you need to prevent DropBear SSH (if enabled/function) from starting at reboot.
mv /etc/rc.d/rc2.d/S05dropbear ~

Reboot device and connect with ssh. If you have problems, use telnet to resolve configuration issues. Good luck!

Mike


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

All times are UTC+01:00


Who is online

Users browsing this forum: No registered users and 3 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