一、编译zlib-1.2.7
二、编译openssl-1.0.1e
四、操作目标板
二、编译dropbear
四、配置嵌入式系统
(dropbear移植完报错,未解决)
1、修改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 2、make clean 3、./configure -prefix=~/code/ssh/ssh/install/zlib-1.2.7 4、make 5、make install |
1、make clean 2、./Configure --prefix=~/code/ssh/ssh/install/openssl-1.0.1e os/compiler:arm-none-linux-gnueabi-gcc 3、make 4、make install |
报错:
解决方法是:编辑/usr/bin/pod2man文件,注释掉第71行。
千万注意,不要像网上有些说的rm /usr/bin/pod2man,即删除pod2man这个文件,否则安装pcsc组件会出错
三、编译openssh-6.1p1
1、#./configure --host=arm-none-linux-gnueabi --with-libs --with-zlib=~/code/ssh/ssh/install/zlib-1.2.7 --with-ssl-dir=~/code/ssh/ssh/install/openssl-1.0.1e --disable-etc-default-login CC=arm-none-linux-gnueabi-gcc AR=arm-none-linux-gnueabi-ar(编译出错,应该去掉--with-libs) #./configure --host=arm-none-linux-gnueabi --with-zlib=~/code/ssh/ssh/install/zlib-1.2.7 --with-ssl-dir=~/code/ssh/ssh/install/openssl-1.0.1e --disable-etc-default-login CC=arm-none-linux-gnueabi-gcc AR=arm-none-linux-gnueabi-ar 2、make 注意:openssh不需要make install |
1、确保目标板上有以下目录,若没有,则新建: /usr/local/bin/ /usr/local/sbin/ /usr/local/etc/ /usr/local/libexec/ /var/run/ /var/empty/ 2、openssh-6.1p1目录下创建目录 mkdir usr mkdir usr/local mkdir usr/local/bin usr/local/sbin usr/local/etc usr/local/libexec mkdir var mkdir var/run var/empty 3、拷贝文件至创建的目录 cp sftp ssh ssh-add ssh-agent ssh-keygen ssh-keyscan usr/local/sbin/ cp ssh_config sshd_config usr/local/etc/ cp sftp-server ssh-keysign usr/local/libexec/ cp sshd usr/local/sbin/ 4、生成Key文件 openssh-6.1p1目录下运行: 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_host_dsa_key、ssh_host_ecdsa_key、ssh_host_rsa_key这3个文件copy到目标板的 /usr/local/etc/目录下 cp ssh_host_*_key usr/local/etc/ 5、修改目标板passwd文件。 在/etc/passwd 中添加下面这一行 sshd:x:74:74:Privilege-separated SSH:/var/empty/sshd:/sbin/nologin 6、执行 [root@$Louis210: /]# /usr/local/sbin/sshd 报错: 解决方法:chmod 600 sshd_config ssh_host_dsa_key ssh_host_key ssh_host_rsa_key |
五、使用SecureCrt连接开发板
连接成功!
六、启动Stfp服务
启动Stfp服务,报错: 解决方法:文件执行权限不够 查看后台进程,sftp已经运行(sftp开启可能会花比较多的时间) 如果查看不到sftp服务,则会证明sftp服务开启失败,需要修改配置文件\rootfs\usr\local\etc\sshd_config |
七、安装dropbear
一、编译zlib-1.2.11
1、修改Makefile或Makefile.in 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 2、make clean 3、./configure -prefix=~/code/ssh/ssh/install/zlib-1.2.11 4、make 5、make install |
./configure --prefix=/root/code/ssh/dropbear/dropbear --with-zlib=/usr/local/zlib/ CC=arm-none-linux-gnueabi-gcc --host=arm make make scp make install cp scp /root/code/ssh/dropbear/dropbear/bin/ |
三、移植至开发板
将/root/code/ssh/dropbear/dropbear/bin/和/root/code/ssh/dropbear/dropbear/sbin/下的文件都复制到板上/usr/sbin目录。 在板上生成server key: 1.cd /etc 2.mkdir dropbear 3.cd dropbear 4.dropbearkey -t rsa -f dropbear_rsa_host_key 5.dropbearkey -t dss -f dropbear_dss_host_key 在启动脚本/etc/init.d/rcS中增加: /usr/sbin/dropbear |
修改root或用户密码 [root@$Louis210: /]# passwd root Changing password for root New password: Retype password: Password for root changed by root 或者: root状态下在板上输入命令添加用户Louis和设置密码 [root@$Louis210: /]# adduser Louis Changing password for myland New password: Retype password: Password for myland changed by root |
五、访问开发板
报错: 解决方法:用OpenSSH的人都知ssh会把你每个你访问过计算机的公钥(public key)都记录在~/.ssh/known_hosts。当下次访问相同计算机时,OpenSSH会核对公钥。如果公钥不同,OpenSSH会发出警告,避免你受到DNS Hijack之类的攻击。(这是删除虚拟机Ubuntu中的文件) |