移植openssh

5 篇文章 0 订阅

一、环境介绍

1.1 宿主机

Ubuntu 1404 32 位

1.2 嵌入式平台

ATMEL AT91SAM9X25

1.3 交叉工具链

arm-none-linux-gnueabi

openssh-7.5-p1移植所需源码包下载地址

二、交叉编译

2.1 先编译 openssh-7.5-p1 依赖的模块

2.1.1 zlib

tar xvf zlib-1.2.11.tar.xz 
cd zlib-1.2.11/
export CC=arm-none-linux-gnueabi-gcc
./configure  --prefix=$PWD/tmp
make CC=arm-none-linux-gnueabi-gcc AR=arm-none-linux-gnueabi-ar LD=arm-none-linux-gnueabi-ld ANLIB=arm-none-linux-gnueabi-ranlib
make install

2.1.2 openssl

 tar xvf openssl-1.0.2o.tar.gz 
 cd openssl-1.0.2o/
 ./Configure --prefix=$PWD/tmp os/compiler:arm-none-linux-gnueabi-gcc
 make 
 make install

2.2 openssh

    不执行 make install, 因为安装是在当前系统部署
bash
tar xvf openssh-7.5p1.tar.gz
cd openssh-7.5p1/
./configure --host=arm-none-linux-gnueabi --build=i686-linux --prefix=$PWD/tmp --bindir=/usr/bin --sbindir=/usr/sbin --sysconfdir=/etc/ssh --libexecdir=/usr/libexec --with-privsep-user=sshd --with-privsep-path=/var/empty -with-libs --with-zlib=/home/gino/work/jiaxian/9X25/transplant/openssh-node/zlib-1.2.11/tmp --with-ssl-dir=/home/gino/work/jiaxian/9X25/transplant/openssh-node/openssl-1.0.2o/tmp --disable-etc-default-login CC=arm-none-linux-gnueabi-gcc AR=arm-none-linux-gnueabi-ar --disable-lastlog --disable-utmp --disable-utmpx --disable-wtmp --disable-wtmpx
make

三、部署

3.1 ssh 运行依赖的设备文件

/dev/tty
/dev/random
/dev/urandom

3.2 文件及目录

 /var/empty

~ # ls -l /etc/ssh

-rw-r--r--    1 root     root          1642 May 21  2018 ssh_config
-rw----r--    1 root     root           668 May 21  2018 ssh_host_dsa_key
-rw-r--r--    1 root     root           598 May 21  2018 ssh_host_dsa_key.pub
-rw----r--    1 root     root           227 May 21  2018 ssh_host_ecdsa_key
-rw-r--r--    1 root     root           170 May 21  2018 ssh_host_ecdsa_key.pub
-rw----r--    1 root     root           399 May 21  2018 ssh_host_ed25519_key
-rw-r--r--    1 root     root            90 May 21  2018 ssh_host_ed25519_key.pub
-rw----r--    1 root     root          1675 May 21  2018 ssh_host_rsa_key
-rw-r--r--    1 root     root           390 May 21  2018 ssh_host_rsa_key.pub
-rw-r--r--    1 root     root          3156 May 21  2018 sshd_config

/usr/bin/scp
/usr/bin/sftp
/usr/bin/ssh
/usr/bin/ssh-add
/usr/bin/ssh-agent
/usr/bin/ssh-keygen
/usr/bin/ssh-keyscan

/usr/sbin/sshd

/usr/libexec/sftp-server
/usr/libexec/ssh-keysign

**note:**key 文件的生成是在目标板执行以下命令,另外需要注意的是 key 文件的权限

cd /etc/ssh/
ssh-keygen -t rsa1 -f ssh_host_key -N ""
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 ""
ssh-keygen -t ed25519 -f ssh_host_ed25519_key -N ""

3.3 其它需要修改的文件

  • /etc/passwd 新增
sshd:x:74:74:Privilege-separated SSH:/var/empty/sshd:/sbin/nologin
  • /etc/ssh/sshd_config 修改
PermitRootLogin yes
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值