arm开发板-linux系统-ssh移植记录

来源:互联网 发布:柒牌网络时尚是真品吗 编辑:程序博客网 时间:2024/05/16 23:20

arm开发板想要使用ssh功能传输文件,需要自己移植该功能。

可以使用提供的工具,直接移植到板子上。具体的编译过程,在最后介绍。

网盘链接:
链接:https://pan.baidu.com/s/1gfaVyQf 密码:0nw6

一、移植

1、系统起来后。新建以下目录。

mkdir /usr/local/mkdir /usr/lcoal/etc/mkdir /usr/local/bin/mkdir /usr/libexec

2、把工具下载下来,搞到U盘上。使用挂载命令挂载。

mount /dev/sda1 /mnt/disk

进入U盘挂载的盘符。进入工具文件夹。

cd local/etc/cp -r * /usr/local/etc/cd ../bin/cp -r * /usr/local/bin/cd ../../libexec/cp -r * /usr/libexec/

3、修改文件、修改权限

cd /usr/local/etc/chmod 600 *

注意这里要使用600权限。其他权限会报错。

cd /etc/vi passwd

使用vim编译器打开passwd文件,并在最后添加如下两行代码:

sshd:x:74:74:Privilege-separatedSSH:/var/empty/sshd:/sbin/nologin

保存退出。

4、修改root密码

passwd root

连续两次输入密码。效果如下。

 passwd root                                                        Changing password for rootNew password: Bad password: too weakRetype password: Password for root changed by root

5、查看开发板ip和主机是不是在同一网段。

vi /etc/eth0-setting

如不一样,修改后保存退出。重启。相同的话直接验证。

reboot

6、验证
使用网线连接开发板和路由器或者主机。并保证开发板和主机可以相互ping通。

/usr/local/bin/sshd

使用上面命令的话,会有如下打印:

 /usr/local/bin/sshd                                                @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@         WARNING: UNPROTECTED PRIVATE KEY FILE!          @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@Permissions 0755 for '/usr/local/etc/ssh_host_key' are too open.It is recommended that your private key files are NOT accessible by others.This private key will be ignored.bad permissions: ignore key: /usr/local/etc/ssh_host_keyCould not load host key: /usr/local/etc/ssh_host_key@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@         WARNING: UNPROTECTED PRIVATE KEY FILE!          @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@Permissions 0755 for '/usr/local/etc/ssh_host_rsa_key' are too open.It is recommended that your private key files are NOT accessible by others.This private key will be ignored.bad permissions: ignore key: /usr/local/etc/ssh_host_rsa_keyCould not load host key: /usr/local/etc/ssh_host_rsa_key@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@         WARNING: UNPROTECTED PRIVATE KEY FILE!          @@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@@Permissions 0755 for '/usr/local/etc/ssh_host_dsa_key' are too open.It is recommended that your private key files are NOT accessible by others.This private key will be ignored.bad permissions: ignore key: /usr/local/etc/ssh_host_dsa_keyCould not load host key: /usr/local/etc/ssh_host_dsa_keyDisabling protocol version 1. Could not load host keyDisabling protocol version 2. Could not load host keysshd: no hostkeys available -- exiting.

再次修改一下权限,然后继续使用刚才的命令。

chmod 600 /usr/local/etc/*/usr/local/bin/sshd

此时效果如下:

/usr/local/bin/sshd                                                Disabling protocol version 1. Could not load host key

虽然有一个报错。但此时使用ssh连接开发板,可以连接。并正常使用。
移植完成。
(这个报错不清楚怎么解决了。如果有知道的大神,还望不吝赐教。1260347644@qq.com)

二、编译

刚才使用的文件都是根据源码编译出来的。下面介绍一下编译过程。

ubuntu版本:12.04
编译器:arm-2009q3

cd /home/mkdir ssh

源码上传及解压过程不叙述。
把三个源码上传到/home/ssh目录下。

1、编译zlib

cd zlib-1.2.3/./configure --prefix=/home/ssh/install/zlibvi Makefile~ CC=arm-none-linux-gnueabi-gcc~ LDSHARED=arm-none-linux-gnueabi-gcc~ CPP=arm-none-linux-gnueabi-gcc -E~ AR=arm-none-linux-gnueabi-ar rcmakemake install

2、编译openssl

cd openssl-0.9.8h/./Configure --prefix=/home/ssh/install/openssl  os/compiler:arm-none-linux-gnueabi-gccmakemake install

3、编译openssh

cd openssh-4.6p1/./configure --host=arm-none-linux-gnueabi --with-libs --with-zlib=/home/ssh/install/zlib --with-ssl-dir=/home/ssh/install/openssl --disable-etc-default-login CC=arm-none-linux-gnueabi-gcc AR=arm-none-linux-gnueabi-armake

注意。运行命令时,注意参数空格。另,openssh不需要make install。

在当前目录下,

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-keygen -t dsa -f ssh_host_key -N "" 

使用以上五条命令。会生成五个文件。

4、拷贝文件

mkdir /home/ssh/usr/mkdir /home/ssh/usr/local/mkdir /home/ssh/usr/local/etc/mkdir /home/ssh/usr/local/bin/mkdir /home/ssh/usr/libexec/

之所以新建以上几个文件夹是为了好对应。

cd /home/ssh/openssh-4.6p1/ cp ssh_host*_key /home/ssh/usr/local/etc/cp scp sftp ssh sshd ssh-add ssh-agent ssh-keygen ssh-keyscan /home/ssh/usr/local/bin/cp moduli ssh_config sshd_config /home/ssh/usr/local/etc/cp sftp-server ssh-keysign /home/ssh/usr/libexec/cd ../tar -vcf usr.tar.gz usr/

生成的usr.tar.gz就是刚才使用的工具包

全部完成。

参考链接:

https://wenku.baidu.com/view/1d0cfd2a84254b35eefd34f8.html

阅读全文
'); })();
0 0
原创粉丝点击
热门IT博客
热门问题 老师的惩罚 人脸识别 我在镇武司摸鱼那些年 重生之率土为王 我在大康的咸鱼生活 盘龙之生命进化 天生仙种 凡人之先天五行 春回大明朝 姑娘不必设防,我是瞎子 渡劫要求 2014年终南山渡劫事件 峨眉发生修真渡劫事件 1995年安徽巨蟒渡劫 渡口 相思渡口 风陵渡口 大渡口 东昌渡口 重庆大渡口 渡口标志 大渡口古镇 西渡口论坛 安顺场渡口 大渡口万达 三林渡口 渡口席慕容 大渡口房价 渡口下载 渡口歌词 各有渡口 渡口所 渡口市 长征第一渡口旅游 相思渡口原唱 伊人渡口长相守 大渡口的驾校 益阳大渡口中学 大渡口蛋糕店 渡口是什么意思 渡情 渡情简谱 渡情歌词 渡情原唱 渡情dj 渡情歌曲 渡情搞笑版 渡情演唱会 渡情 ape 渡情吉他谱 渡情笛子独奏