Migrate ssh service to EK200-zlib-openssl-openssh
[Copy link]
download:
The version I downloaded is:
zlib-1.2.11.tar.gz
openssl-1.0.2s.tar.gz
openssh-5.9p1.tar.gz
$ cd
$ mkdir ssh
$ cd ssh
$ mkdir compressed source install
Move the source package to /home/myzr/ssh/compressed/:
$ mv /home/myzr/openssh-5.9p1.tar.gz /home/myzr/ssh/compressed/
$ mv /home/myzr/openssl-1.0.2s.tar.gz /home/myzr/ssh/compressed/
$ mv /home/myzr/zlib-1.2.11.tar.gz /home/myzr/ssh/compressed/
$ cd /home/myzr/ssh/compressed/
Unzip the source code to the source directory:
$ tar xzvf zlib-1.2.11.tar.gz -C ../source/
$ tar xzvf openssl-1.0.2s.tar.gz -C ../source/
$ tar xzvf openssh-5.9p1.tar.gz -C ../source/
Source cross toolchain:
$ source /home/myzr/my-work/03_toolchain/fsl-imx-fb-glibc-x86_64-meta-toolchain-qt5-cortexa9hf-neon-toolchain-4.1.15-2.1.0/environment-setup-cortexa9hf-neon-poky-linux-gnueabi
zlib compilation:
$ cd /home/myzr/ssh/source/zlib-1.2.11/
$ ./configure --prefix=/home/myzr/ssh/install/zlib
$ make
$ make install
Openssl compilation:
$ cd /home/myzr/ssh/source/openssl-1.0.2s/
$ ./Configure --prefix=/home/myzr/ssh/install/openssl/ os/compiler:arm-poky-linux-gnueabi-gcc
$ vi Makefile
将CC= $(CROSS_COMPILE)arm-poky-linux-gnueabi-gcc
Modify CC = arm-poky-linux-gnueabi-gcc
$ make
$ make install
Compile openssh:
$ cd /home/myzr/ssh/source/openssh-5.9p1/
$ ./configure --host=arm-poky-linux-gnueabi --with-libs --with-zlib=/home/myzr/ssh/install/zlib --with-ssl-dir=/home/myzr/ssh/install/openssl --disable-etc-default-login AR=arm-poky-linux-gnueabi-ar
$ make
If error occurs: arm-poky-linux-gnueabi-ld: unrecognized option '-Wl,-O1'
# we Makefile
Change $(LD) to $(CC) in lines 141-175.
即 $(LD) -o $@ $(SSHOBJS) $(LDFLAGS) -lssh -lopenbsd-compat $(SSHLIBS) $(LIBS)
到 $(LD) -o $@ logintest.o $(LDFLAGS) loginrec.o -lopenbsd-compat -lssh $(LIBS)
Change all $(LD) in to $(CC)
如:$(LD) -o $@ $(SSHOBJS) $(LDFLAGS) -lssh -lopenbsd-compat $(SSHLIBS) $(LIBS)
改为$(CC) -o $@ $(SSHOBJS) $(LDFLAGS) -lssh -lopenbsd-compat $(SSHLIBS) $(LIBS)
$ make
Execute on the development board:
mkdir /usr/local/sbin/
mkdir /usr/local/etc/
mkdir /usr/local/libexec/
Change the following under /home/myzr/ssh/source/openssh-5.9p1/:
scp sftp ssh ssh-add ssh-agent ssh-keygen ssh-keyscan
Copy these files to the /usr/local/bin directory of the development board
moduli ssh_config sshd_config
Copy to the /usr/local/etc directory of the development board
sftp-server ssh-keysign
Copy to the /usr/local/libexec directory of the development board
sshd
Copy to the /usr/local/sbin/directory of the development board
Generate a Key file and operate on the virtual machine :
$ 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 ""
As shown in the figure: 1, 2, 3
$ mkdir key
$ cp ssh_host_*_key key
$ cd key
Copy the files in the key to the/usr/local/etc/ directory of the development board
# vi/etc/passwd
Add the following line to the development board /etc/passwd
sshd:x:74:74rivilege-separated SSH:/var/empty/sshd:/sbin/nologin
As shown in the figure: 4
After copying all to the corresponding directory of the development board, execute on the development board:
# chmod 0 /usr/local/etc/ssh_host_*
Execute sshd:
# /usr/local/sbin/sshd
Set root password
# passwd root
Log in using ssh (omitted)
|