Android下的dropbear编译

dropbear是ssh的一个实现,包含了客户端和服务端以及相关的配置组件

Android下没有包含/etc/passwd等目录结构,并不能直接使用dropbear建立ssh服务

修改及编译过程如下:

安装交叉编译环境

下载0.52版的dropbear

  • 下载dropbear0.52-android.patch到源码上层目录
  • 切换到dropbear的目录执行:
  • patch < ../dropbear0.52-android.patch

准备编译

./configure --host=arm-none-linux-gnueabi 
--disable-zlib 
--disable-largefile 
--disable-loginfunc 
--disable-shadow 
--disable-utmp 
--disable-utmpx 
--disable-wtmp 
--disable-wtmpx 
--disable-pututline 
--disable-pututxline 
--disable-lastlog 
CC=arm-none-linux-gnueabi-gcc
export STATIC=1 MULTI=0 CC=arm-none-linux-gnueabi-gcc SCPPROGRESS=0 PROGRAMS="dropbear dropbearkey scp dbclient"
make strip

生成的dropbear可以理解为就是sshddbclient就是ssh
建立ssh服务

dropbearkey -t rsa -f /system/etc/dropbear/dropbear_rsa_host_key
dropbearkey -t dss -f /system/etc/dropbear/dropbear_dss_host_key
dropbear -A -N <username> -C <password> -E

发表回复

您的电子邮箱地址不会被公开。 必填项已用 * 标注