聚合国内IT技术精华文章,分享IT技术精华,帮助IT从业人士成长

Buffalo LS421DE-CN 获取root权限

2014-02-20 17:25 浏览: 3029784 次 我要评论(0 条) 字号:

新买了一台 Buffalo LS421DE-CN 网络硬盘盒,其上运行的是arm linux系统,为了便于安装其他自定程序,首先进行root权限获取。
这儿一篇直接修改升级包文件的

http://forum.buffalo.nas-central.org/viewtopic.php?f=68&t=28225

采取老方法到Buffalo网站下载acp_commander.jar 文件
确认安装java后,在acp_commander.jar 目录下执行如下命令

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客户端连接,不能连上,使用如下命令运行

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

然后在盒子share目录下查看log.txt 发现是SFTP的问题,

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文件,将其中

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

几行删除,保存后(最好将原文件做备份)再执行如下命令:

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生成他

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连接盒子,哈,熟悉的界面窗口出来了,可以后续工作了。

(觉得命令行输入这么长的命令很麻烦,可以使用更方便操作的 acp_commander_gui, google可以搜索到,运行后直接就可以找到盒子的ip列表,选中盒子然后输入盒子的admin密码,这个时候只要输入上述命令行 -c 参数部分的命令就好了)



网友评论已有0条评论, 我也要评论

发表评论

*

* (保密)

Ctrl+Enter 快捷回复