码迷,mamicode.com
首页 > 其他好文 > 详细

安装openssh 到 am5728 板子上

时间:2016-09-29 22:17:48      阅读:421      评论:0      收藏:0      [点我收藏+]

标签:am5728

安装openssh 到 am5728 板子上

注意:目录不要放到虚拟机与windows的共享目录。

  1. 准备

虚拟机上进到目录 /home/llf/ssh

创建目录:zlib.install 和 openssl.install
$ cd ssh                                      # 进入 ssh 目录  
$ mkdir zlib.install                      # 新建 zlib 安装目录,移植过程 zlib 镜像会安装到该目录
$ mkdir openssl.install                # 新建 openssl 安装目录,移植过程 openssl 镜像会安装到该目录


2.编译3个东西
zlib:   zlib-1.2.8.tar.gz

tar zxvf zlib-1.2.8.tar.gz,进入目录

prefix=/home/veryarm/ssh/zlib.install CC=arm-none-linux-gnueabi-gcc ./configure
make
make install


openssl :  openssl-1.1.0b.tar.gz

解压后进行目录

./Configure no-asm --prefix=/mnt/hgfs/share/mini5728/ssh/openssl.install/  --cross-compile-prefix=arm-linux-gnueabihf- linux-generic32 shared
make
make install
注意:一定要shared , 好像是openssh6.0以上必须要用shared openssl


openssh:  openssh-6.0p1.tar.gz

解压后进行目录

./configure --host=arm-linux-gnueabihf --with-libs --with-zlib=/mnt/hgfs/share/mini5728/ssh/zlib.install --with-ssl-dir=/mnt/hgfs/share/mini5728/ssh/openssl.install --disable-etc-default-login CC=arm-linux-gnueabihf-gcc AR=arm-linux-gnueabihf-ar
make
(无需make install)
3.
确保目标板上有以下目录,若没有,则新建:

/usr/local/bin
/usr/local/etc
/usr/libexec
/var/run
/var/empty

加权限
# chown root:root /var/empty
# chmod 755 /var/empty

4.
将PC机 /home/veryarm/ssh/openssh-6.6p1/ 目录下文件拷贝到目标板系统中,具体为:

    scp、sftp、ssh sshd、ssh-add、ssh-agent、ssh-keygen、ssh-keyscan共8个文件拷贝到目标板/usr/local/bin
    moduli、ssh_config、sshd_config共3个文件拷贝到目标板 /usr/local/etc
    sftp-server、ssh-keysign 共2个文件拷贝到目标板 /usr/libexec

5.
生成Key文件

在目标版 /usr/local/etc/ 目录下生成key文件:

$ cd /usr/local/etc/
$ 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 dsa -f ssh_host_ed25519_key -N ""

修改 ssh_host_ed25519_key 权限为 600:

$ chmod 600 ssh_host_ed25519_key

6.
目标板用户信息

打开 /etc/passwd 文件,在最后添加下面这一行:

sshd:x:74:74:Privilege-separated SSH:/var/empty/sshd:/sbin/nologin

如果开发板的 root 用户还没有密码,键入以下命令然输入两次密码来修改,否其他设备无法连:

$ passwd root

7. 测试

服务测试:
$ /usr/local/bin/sshd

客户端测试:
$ ssh root@192.168.2.230(开发板的ip)

上传文件测试;
scp Makefile root@192.168.2.230:/home/root/

下载文件测试:
scp root@192.168.2.230:/home/root/Makefile123 ./

本文出自 “软件技术” 博客,请务必保留此出处http://danielllf.blog.51cto.com/2442311/1857829

安装openssh 到 am5728 板子上

标签:am5728

原文地址:http://danielllf.blog.51cto.com/2442311/1857829

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!