arm交叉编译 sshd服务器让外界登陆。
来源:互联网 发布:矩阵加1 编辑:程序博客网 时间:2024/06/05 07:16
转自:http://blog.sina.com.cn/s/blog_7f2a9a390100xws4.html
步骤:
1.下载源码包,地址如下:
opensshopenssl
zlib
2.交叉编译
创建工作目录:
#mkdir /work#cd /work
在/work目下面创建ssh目录
# mkdir /work/lib
# mkdir /work/ssh
# cd
# mkdir compressed install source
#mv tarpakgs/openssh-4.6p1.tar.gz
#mv tarpakgs/openssl-0.9.8e.tar.gz
#mv tarpakgs/zlib-1.2.3.tar.gz
解压安装包:
# cd /work/ssh/compressed/# tar zxvf zlib-1.2.3.tar.gz
# tar zxvf openssl-0.9.8e.tar.gz
# tar zxvf openssh-4.6p1.tar.gz
交叉编译 zlib:
# cd
# ./configure --prefix=/work/ssh/install/zlib-1.2.3
# vim Makefile
CC=arm-none-linux-gnueabi-gcc
AR=arm-none-linux-gnueabi-ar rc
CPP =arm-none-linux-gnueabi-gcc -E
LDSHARED=arm-none-linux-gnueabi-gcc
# make
# make install
交叉编译openssl
# cd
# ./Configure --prefix=/work/ssh/install/openssl-0.9.8e
# make
# make install
# cd
#./configure --host=arm-none-linux-gnueabi
#make
注意:openssh不需要make install
3.操作目标板
3.1确保目标板上有以下目录,若没有,则新建:
/usr/local/bin/3.2从PC机上将以下文件拷贝到目标板Linux系统中
PC机 /work/ssh/source/openssh-4.6p1/ 目录下的
scp
moduli ssh_config sshd_config拷贝到目标板 /usr/local/etc
sftp-server
sshd 拷贝到目标板 /usr/local/sbin/
3.3生成Key文件
在PC机 /work/ssh/source/openssh-4.6p1/ 目录下运行:
ssh-keygen -t rsa -f ssh_host_rsa_key -N ""
ssh-keygen -t dsa -f ssh_host_dsa_key -N ""
ssh-keygen -t ecdsa -f ssh_host_ecdsa_key -N ""
sno:如果开发板需要 ssh_host_key的话,可以执行: ssh-keygen -t rsa1 -f ssh_host_key -N "" 。
将生成的 ssh_host_*_key这3个文件copy到目标板的 /usr/local/etc/目录下
3.4修改目标板passwd文件。
在/etc/passwd 中添加下面这一行
sshd:x:74:74:Privilege-separated SSH:/var/empty/sshd:/sbin/nologin
4.测试
在目标板上运行:#/usr/local/sbin/sshd
可以用ps命令查看sshd是否在工作
如果运行的过程中有提示缺少动态连接库,可以在主机上搜索相应文件,拷贝到目标板/lib/目录下面,注意创建软连接!
OK!不出意外的话可以成功,
主机上:
#ssh root@192.168.0.34(开发板的ip)
然后输入开发板的root密码就就可以了。
//root密码就是你开发板上root的密码,如果之前root没有密码,需要重新设置,用passwd root,然后输入密码即可。
登录成功后如下图:
问题总结
sshd: /lib/libc.so.6: version `GLIBC_2.7' not found (required by sshd)
问题分析:说明你编译等时候指定等glibc和目标板所使用的不一致。
解决办法:配置openssh,即./configure时,使用对用等--host参数,如--host=arm-linux/arm-none-linux-gnueabi。
2.make openssl的时候,指定的prefix目录已经存在,无法创建。
问题分析:这是因为在prefix目录的时候,使用了相对路径,如../../install。
解决办法:openssl需要用指定绝对路径来安装,prefix参数应该如:--prefix=/work/ssh/install/openssl-1.0.0
3.使用arm-2007q3-51-arm-none-linux-gnueabi.bin的make编译ssh和gdbserver时出错:
/root/CodeSourcery/Sourcery_G++_Lite/bin/../lib/gcc/arm-none-linux-gnueabi/4.2.1/../../../../arm-none-linux-gnueabi/bin/ld: cannot find -lgcc_s
collect2: ld returned 1 exit status
make: *** [example] 错误 1
问题解析:
解决办法:
可能一解决:查找/root/CodeSourcery/Sourcery_G++_Lite/arm-none-linux-gnueabi/libc/lib目录,如果有libgcc_s.so.1,做一个链接:ln -s libgcc_s.so.1 libgcc_s.so,重新make,此问题可以解决。如果再出现以下问题:
4.用nfs从主机复制到目标板时出现:
cp: omitting directory '/etc/boa'
等错误。
问题分析:权限不够,或者目标板中等/usr/local/etc已经有文件。
解决办法:在cp命令后加-r参数,如:cp -r /etc/* /usr/local/etc/
5.运行sshd时出现:
Could not load host key: /usr/local/etc/ssh_host_dsa_key
Could not load host key: /usr/local/etc/ssh_host_ecdsa_key
问题解析:在/usr/local/etc目录中没有相应等key。
解决办法:按照操作步骤,运行:
生成ssh_host_das_key 和ssh_host_ecdas_key后复制到目标板/usr/local/etc/目录下。
6.从nfs复制key文件到usr/local/etc时出现:
cp: can't open 'ssh_host_dsa_key': Permission denied
问题分析:目标板复制权限不够。
解决办法:在主机中修改他们等权限为777,命令:chmod 777 *
7.Privilege separation user sshd does not exist
//需要在开发板的系统里adduser shhd
//或者在/etc/passwd 中添加下面这一行
sshd:x:74:74:Privilege-separated SSH:/var/empty/sshd:/sbin/nologin
8.Permissions 0755 for '/usr/local/etc/ssh_host_dsa_key' are too open.
//则把目标板/usr/local/etc/下的ssh_host_*几个文件的权限改为700。如果出现权限不够问题,用su - root进入root用户再改。
命令:#chmod 700 ssh_host_*
9.Permission denied (publickey,password,keyboard-interactive).
//打开开发板/usr/local/sshd_config,将PermitRootLogin yes前的注释“#”号去掉。
10.configure配置openssh的时候出错:
configure: error: *** zlib missing - please install first or check config.log ***
问题分析:没有找到zlib。
问题解决:重新交叉编译zlib,再configure即可。
11.以下两个函数没找到:
/home/arm/ssh-omap/source/openssh-5.8p2/ssh-keygen.c:1410: undefined reference to `pkcs11_init'
/home/arm/ssh-omap/source/openssh-5.8p2/ssh-keygen.c:1493: undefined reference to `pkcs11_terminate'
问题解决:
打开ssh-keygen.c:vi ssh-keygen.c
屏蔽这1410和1493这两行函数。
- arm交叉编译 sshd服务器让外界登陆。
- arm交叉编译 sshd服务器让外界登陆。
- arm交叉编译 sshd服务
- 交叉编译apache服务器for ARM Linux
- 交叉编译apache服务器for ARM Linux
- 交叉编译apache服务器for ARM Linux
- gdb 交叉编译arm
- arm 交叉编译环境
- boost arm 交叉编译
- ARM交叉编译环境
- ARM交叉编译环境
- arm交叉编译Valgrind
- perf arm交叉编译
- ARM 交叉编译 Valgrind
- ARM GDB交叉编译
- arm交叉编译libidn
- 交叉编译arm gdb
- arm交叉编译Valgrind
- mongodb sharding cluster(分片集群)
- HRBEU 1390 帮派 并查集 + 向量偏移
- OC之归档
- 战争迷雾3
- Socket编程介绍
- arm交叉编译 sshd服务器让外界登陆。
- Objective-C中使用NSValue、NSNull、NSNumber、NSDecimalNumber、NSData、NSMutableData 小结
- Java的String使用
- 战争迷雾4
- OCP-1Z0-052-V8.02-100题
- Java中接口的使用
- C++的对象复制构造函数与赋值操作符重载的区别小结
- 如何将错误提示框变成有 错误提示码的提示框
- lua学习之——有道词典“划词”的秘密