2013年5月13日 星期一

sshd crosee compilier

sshd crosee compilier

zlib

wget http://zlib.net/zlib-1.2.8.tar.gz
tar xvf zlib-1.2.8.tar.gz
cd zlib-1.2.8
CC=arm-mv5sft-linux-gnueabi-gcc ./configure --prefix=`pwd`/./install
make
make install

openssl

wget http://www.openssl.org/source/openssl-1.0.1e.tar.gz
tar xvf openssl-1.0.1e.tar.gz
cd openssl-1.0.1e
./Configure --prefix=`pwd`/./install  os/compiler:arm-mv5sft-linux-gnueabi-gcc
make
make install

openssh

wget http://ftp.jaist.ac.jp/pub/OpenBSD/OpenSSH/portable/openssh-6.2p1.tar.gz
tar xvf openssh-6.2p1.tar.gz
cd openssh-6.2p1
./configure --host=arm-mv5sft-linux-gnueabi --with-libs --with-zlib=../zlib-1.2.8/install/ --with-ssl-dir=../openssl-1.0.1e/install --disable-etc-default-login CC=arm-mv5sft-linux-gnueabi-gcc AR=arm-mv5sft-linux-gnueabi-ar
make


將 sshd, ssh-keygen 複製到 ARM target board /usr/bin/
將 libz.so 複製到 ARM target board /usr/lib/

執行 sshd, 一定要用絕對路徑@@@@
/usr/bin/sshd

會依次出現下面的錯誤訊息

/usr/local/etc/sshd_config: No such file or directory
    將 sshd_config 複製到 ARM target board /usr/local/etc
Privilege separation user sshd does not exist
    在/etc/passwd 中添加下面這一行
    sshd:x:74:74:Privilege-separated SSH:/var/empty/sshd:/sbin/nologin
Could not load host key: /usr/local/etc/ssh_host_rsa_key
Could not load host key: /usr/local/etc/ssh_host_dsa_key
Could not load host key: /usr/local/etc/ssh_host_ecdsa_key
Disabling protocol version 2. Could not load host key
sshd: no hostkeys available -- exiting.
    ssh-keygen -t dsa -f /usr/local/etc/ssh_host_dsa_key
    ssh-keygen -t rsa -f /usr/local/etc/ssh_host_rsa_key
    ssh-keygen -t dsa -f /usr/local/etc/ssh_host_ecdsa_key
Missing privilege separation directory: /var/empty
    mkdir -p /var/empty


再執行 /usr/bin/sshd, 應該就好了。可以用 ssh 測試看看

ssh root@192.168.199.99(target board 的 ip)
然後輸入 root 密碼就就可以了.


沒有留言:

張貼留言