Porting the remote connection tool dropbear under ARM linux
Original address: http://www.cnblogs.com/NickQ/p/9010529.html
port zlib
Download address: https://github.com/madler/zlib/archive/v1.2.10.tar.gz
Get zlib and extract it
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
Generate Makefile
./configure --prefix=/usr/local/zlib --static
Edit 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
Create installation folder
mkdir install
cross compile
make && make install
porting dropbear
Download address: https://matt.ucc.asn.au/dropbear/releases/dropbear-2016.74.tar.bz2
Get and unzip
wget https://matt.ucc.asn.au/dropbear/releases/dropbear-2016.74.tar.bz2
tar -xjf dropbear-2016.74.tar.bz2
Create installation folder
cd ./dropbear-2016.74
mkdir install
Generate Makefile
./configure --prefix=`pwd`/install --with-zlib=`pwd`/../zlib-1.2.10/install CC=/opt/xtools/arm920t/bin/arm-linux-gcc --host=arm
Compile and install
make PROGRAMS="dropbear dbclient dropbearkey dropbearconvert scp"
make PROGRAMS="dropbear dbclient dropbearkey dropbearconvert scp" install
generated file tree
[root@XQLY install]$ tree ./
./
├── bin
│ ├── dbclient
│ ├── dropbearconvert
│ ├── dropbearkey
│ └── scp
├── sbin
│ └── dropbear
└── share
└── man
├── man1
│ ├── dbclient.1
│ ├── dropbearconvert.1
│ └── dropbearkey.1
└── man8
└── dropbear.8
Package the generated files
tar -czf dropbear.nick.tar.gz ./install
The development board downloads and decompresses this package, and puts bin and sbin in the /usr/sbin path. ( remember to give executable permission )
Configure dropbear, generate rsa, dss keys
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
add startup
vim /etc/init.d/S00_dropbear
添加 /usr/sbin/dropbear -R
test
/etc/init.d/S00_dropbear
other
closure
killall dropbear
View progress
[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
Check port listening status
[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
problems encountered
Connect using SecureCRT, prompt
The remote system refused the connection.
In the end, it was found that the IP set by SecureCRT was incorrect. (It's almost like I'm crying stupidly) As shown in the
figure , the
development board IP:
IP set by SecureCRT: