移植ARM linux下远程连接工具dropbear

移植ARM linux下远程连接工具dropbear

原文地址:http://www.cnblogs.com/NickQ/p/9010529.html

移植zlib

下载地址:https://github.com/madler/zlib/archive/v1.2.10.tar.gz
获取zlib并解压

wget https://github.com/madler/zlib/archive/v1.2.10.tar.gz -O zlib-1.2.10.tar.gz
tar -zxvf zlib-1.2.10.tar.gz

生成Makefile

./configure --prefix=/usr/local/zlib --static

编辑Makefile

CC=/opt/xtools/arm920t/bin/arm-linux-gcc
LDSHARED=/opt/xtools/arm920t/bin/arm-linux-gcc
CPP=/opt/xtools/arm920t/bin/arm-linux-gcc -E
AR=/opt/xtools/arm920t/bin/arm-linux-ar
prefix =`pwd`/install

创建安装文件夹

mkdir install

交叉编译

make && make install

移植dropbear

下载地址:https://matt.ucc.asn.au/dropbear/releases/dropbear-2016.74.tar.bz2
获取并解压

wget https://matt.ucc.asn.au/dropbear/releases/dropbear-2016.74.tar.bz2
tar -xjf dropbear-2016.74.tar.bz2

创建安装文件夹

cd ./dropbear-2016.74
mkdir install

生成Makefile

./configure --prefix=`pwd`/install --with-zlib=`pwd`/../zlib-1.2.10/install CC=/opt/xtools/arm920t/bin/arm-linux-gcc --host=arm

编译安装

make PROGRAMS="dropbear dbclient dropbearkey dropbearconvert scp"
make PROGRAMS="dropbear dbclient dropbearkey dropbearconvert scp" install

生成的文件树

[root@XQLY install]$ tree ./
./
├── bin
│   ├── dbclient
│   ├── dropbearconvert
│   ├── dropbearkey
│   └── scp
├── sbin
│   └── dropbear
└── share
    └── man
        ├── man1
        │   ├── dbclient.1
        │   ├── dropbearconvert.1
        │   └── dropbearkey.1
        └── man8
            └── dropbear.8

打包生成的文件

tar -czf dropbear.nick.tar.gz ./install

开发板下载并解压这个包,并将bin,sbin放置到/usr/sbin路径下即可。(记得赋予可执行权限

配置dropbear,生成rsa,dss密匙

mkdir /etc/dropbear
dropbearkey -t dss -f /etc/dropbear/dropbear_dss_host_key
dropbearkey -t rsa -s 4096 -f /etc/dropbear/dropbear_rsa_host_key

加入启动项

vim /etc/init.d/S00_dropbear
添加 /usr/sbin/dropbear -R

测试

/etc/init.d/S00_dropbear

其他

关闭

killall dropbear

查看进程

[root@NickQ_fl2440 ~]# ps
  PID USER       VSZ STAT COMMAND
    1 root      2204 S    {linuxrc} init
    2 root         0 SW   [kthreadd]
    
省略部分内核进程    
    
  988 root         0 SW<  [kpsmoused]
 1009 root         0 SWN  [jffs2_gcd_mtd2]
 1020 root      2180 S    /usr/sbin/dropbear -R
 1026 root      2208 S    -sh
 1027 root      2204 S    /sbin/syslogd -n
 1028 root      2204 S    /sbin/klogd -n
 1031 root      2208 R    ps

查看端口监听状态

[root@NickQ_fl2440 ~]# netstat -tlnp
 Active Internet connections (only servers)
 Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name    
 tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      1020/dropbear
 tcp        0      0 :::22               

遇到的问题

使用SecureCRT连接,提示

The remote system refused the connection.

最后发现是SecureCRT设置的IP不对。(简直是快要被自己蠢哭了)
如图
开发板IP:
开发板

SecureCRT设置的IP:
SecureCRT

posted @ 2018-05-08 19:37  NickQ  阅读(2237)  评论(0编辑  收藏  举报