Buffalo LS421DE-CN 获取root权限

新买了一台 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 参数部分的命令就好了)

Popularity: 10% [?]

Random Posts

一英文软件安装时出现”Failed to open EXE”问题解决

网上下载了一英文软件,点击安装程序出现错误提示”Failed to Open EXE“,不过看老外的论坛,没有人碰到不能运行的问题。经过多次尝试,软件都是不能运行。郁闷

想起以前曾经碰到过的一个国外软件不能运行的解决方法,就是在控制面板地区/语言设置中将其全部设置为英文相关的语言和地区(英语,美国),然后重新启动操作系统,程序运行正常。

照搬之前办法,设置语言和地区为(英语,美国)重新启动,再次执行安装程序,安装成功。

找出了之前不正常的程序,分析之,发现两个软件都是用 M$ 的VB系列语言做的(分别是VB和VB.net),初步猜想是由于VB语言造成的,在不同系统下某些函数的执行的行为不一样。
进一步查找资料,发现VB中关于 Asc, Ascb, AscW等函数在不同系统环境中的行为不一样(非unicode编码)。

由此得到经验: 以后写程序时要注意尽量不要使用VB来做,如果要用VB则需要注意避免使用Asc这类行为会受操作系统平台影响的函数。

Popularity: 6% [?]

Random Posts

ExtMail管理员密码恢复

今天需要使用邮件服务器的管理员账号添加几个转发地址,不过突然发现很久没有用的管理员密码忘记了,存放密码的文件也找不到了,一个字惨。在经过几次尝试后没有办法,寻找恢复密码的方法。

公司使用的ExtMail邮箱服务器包,经过一翻分析后发现可以使用如下的一些方法做管理员密码恢复。

将密码判断部分先去掉,直接以任意密码登陆
sub login函数中

if ($a->auth($user, $pass)) {

修改为

if (1) {

这样可以用任意密码登陆,登陆后将密码修改后不要忘记将这段代码修改回来,要不然可是要出问题的哦…

找到 ExtMail 的初始 init.sql 看到有密码 extmail*123* 的密码加密串值为 $1$BrT9qxfB$Ha81Mb5YVV6rNKNN5jmtj1
使用SQL自己修改数据库记录

update manager set password = ‘$1$BrT9qxfB$Ha81Mb5YVV6rNKNN5jmtj1′ where username = ‘admin’;

将密码复位为 extmail*123* 登陆后修改密码

Popularity: 3% [?]

Related