2015年9月8日 星期二

root Buffalo LS-421DE



NAS 又要更新的時間了


以下參考別人的 blog
再加以修改
做為自己的筆記


看上了一台Buffalo LS421DE NAS
上面當然還是 ARM-Linux 系統
為了方便以後安裝其他程式
1. 首先就是要取得 root 權限。
2. SSH login






有參考到一篇
http://forum.buffalo.nas-central.org/viewtopic.php?f=68&t=28225

話說這時待連 root 的工具都在進步
之前用的 acp_commander.jar 現在有 GUI 版了

看看 acp_commander GUI 的畫面


可以去下面這個網站看看
好像是跟 acp_commander.jar 同一個作者寫的
真是太佛心了
不用打一大堆奇奇怪怪的
java acp_commander.jar ............. 符號

Original site: http://www.gry.ch/Java/styled/


當然用 acp_commander.jar 也是一個方法拉


確認安裝java後,在acp_commander.jar目錄下執行如下命令



1
2
3
4
java -jar acp_commander.jar -t 盒子IP -ip 盒子IP -pw password -c "(echo newrootpass;echo newrootpass)|passwd"
java -jar acp_commander.jar -t 盒子IP -ip 盒子IP -pw password -c "sed -i 's/UsePAM yes/UsePAM no/g' /etc/sshd_config"
java -jar acp_commander.jar -t 盒子IP -ip 盒子IP -pw password -c "sed -i 's/PermitRootLogin no/PermitRootLogin yes/g' /etc/sshd_config"
java -jar acp_commander.jar -t 盒子IP -ip 盒子IP -pw password -c "/etc/init.d/sshd.sh restart"


一切正常,執行一切正常,但是使用ssh客戶端連接,不能連上,使用如下指令看看 error log


1
java -jar acp_commander.jar -t 盒子IP -ip 盒子IP -pw password -c "/etc/init.d/sshd.sh restart >> /mnt/array1/share/log.txt"

然後到 /mnt/array1/share 目錄下 check log.txt 發現是SFTP的問題,

1
java -jar acp_commander.jar -t 盒子IP -ip 盒子IP -pw password -c "cp /etc/init.d/sshd.sh /mnt/array1/share/sshd.sh"


使用EditPlus之類文本編輯工具編輯盒子share目錄下的sshd.sh文件,將其中

1
2
3
4
if [ "${SUPPORT_SFTP}" = "1" ] ; then
        echo "Not support sftp on this model." > /dev/console
        exit 0
fi

幾行刪除
保存後(最好將原文件做備份)再執行如下命令
把檔案蓋掉


1
2
java -jar acp_commander.jar -t 盒子IP -ip 盒子IP -pw password -c "cp /mnt/array1/share/sshd.sh /etc/init.d/sshd.sh "
java -jar acp_commander.jar -t 盒子IP -ip 盒子IP -pw password -c "/etc/init.d/sshd.sh restart >> /mnt/array1/share/log.txt"


使用putty連接還是失敗,繼續查看log.txt ,發現有提示/etc/ssh_host_ecdsa_key 文件未找到,使用 ssh-keygen 產生這個檔案


1
2
java -jar acp_commander.jar -t 盒子IP -ip 盒子IP -pw password -c "ssh-keygen -t ecdsa -f /etc/ssh_host_ecdsa_key -N '' "
java -jar acp_commander.jar -t 盒子IP -ip 盒子IP -pw password -c "/etc/init.d/sshd.sh restart >> /mnt/array1/share/log.txt"


使用putty 連接 NAS
熟悉的 login window 出來了
可以後續工作了。




沒有留言: