移植 ssh

1. 简介

    ssh是远程登陆的一种,在服务器端开启sshd,远程就可以通过ssh协议登陆服务器。同ssh一起的自带sftp子线程,可以实现文件的传送。ssh 同 telnet 相比,是一种加密传输,相对安全。

 

2. 移植

2.1 编译zlib

./configure --prefix=/home/ohehe/wor_lip/porting/ssh/install/zlib CC="arm-fsl-linux-gnueabi-gcc -march=armv7-a -mfloat-abi=hard -mfpu=neon -mtune=cortex-a7 --sysroot=/home/ohehe/ls1021-toolchain/sysroots/cortexa7hf-vfp-neon-fsl-linux-gnueabi" AR="arm-fsl-linux-gnueabi-ar -march=armv7-a -mfloat-abi=hard -mfpu=neon -mtune=cortex-a7 --sysroot=/home/ohehe/ls1021-toolchain/sysroots/cortexa7hf-vfp-neon-fsl-linux-gnueabi"

更改Makefile中的 CC

arm-fsl-linux-gnueabi-gcc -march=armv7-a -mfloat-abi=hard -mfpu=neon -mtune=cortex-a7 --sysroot=/home/ohehe/ls1021-toolchain/sysroots/cortexa7hf-vfp-neon-fsl-linux-gnueabi

AR为arm-fsl-linux-gnueabi-ar

所有gcc更改成$(CC)

make

make install

 

2.2 编译openssl

./Configure --prefix=/home/ohehe/wor_lip/porting/ssh/install/openssl os/compiler:arm-fsl-linux-gnueabi-gcc

更改Makefile中CC

变成

CC= arm-fsl-linux-gnueabi-gcc -march=armv7-a -mfloat-abi=hard -mfpu=neon -mtune=cortex-a7 --sysroot=/home/ohehe/ls1021-toolchain/sysroots/cortexa7hf-vfp-neon-fsl-linux-gnueabi

 

2.3 编译ssh

./configure --host=arm-linux --prefix=/home/ohehe/wor_lip/porting/ssh/install/openssh --with-libs --with-zlib=/home/ohehe/wor_lip/porting/ssh/install/zlib --with-ssl-dir=/home/ohehe/wor_lip/porting/ssh/install/openssl --disable-etc-default-login CC=" arm-fsl-linux-gnueabi-gcc -march=armv7-a -mfloat-abi=hard -mfpu=neon -mtune=cortex-a7 --sysroot=/home/ohehe/ls1021-toolchain/sysroots/cortexa7hf-vfp-neon-fsl-linux-gnueabi" AR=arm-fsl-linux-gnueabi-ar

make

手动将编译出来的文件拷贝到安装路径下

mkdir -p /home/ohehe/wor_lip/porting/ssh/install/openssh/usr/local/bin/
mkdir -p /home/ohehe/wor_lip/porting/ssh/install/openssh/usr/local/
mkdir -p /home/ohehe/wor_lip/porting/ssh/install/openssh/usr/local/etc/
mkdir -p /home/ohehe/wor_lip/porting/ssh/install/openssh/usr/libexec/
mkdir -p /home/ohehe/wor_lip/porting/ssh/install/openssh/usr/sbin/

mkdir -p /home/ohehe/wor_lip/porting/ssh/install/openssh/bin
cp scp sftp ssh ssh-add ssh-agent ssh-keygen ssh-keyscan moduli ssh_config sshd_config sftp-server ssh-keysign sshd /home/ohehe/wor_lip/porting/ssh/install/openssh/bin -a


cp scp sftp ssh ssh-add ssh-agent ssh-keygen ssh-keyscan /home/ohehe/wor_lip/porting/ssh/install/openssh
cp moduli ssh_config sshd_config  /home/ohehe/wor_lip/porting/ssh/install/openssh/usr/local/
cp moduli ssh_config sshd_config /home/ohehe/wor_lip/porting/ssh/install/openssh/usr/local/etc/
cp sftp-server ssh-keysign 

要有 /var/empty 文件

在文件夹 /etc/ssh 下生成 key 文件

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 ""

将生成的key文件放到文件夹/etc/ssh下

更改配置文件内容 sshd_config

打开

HostKey /etc/ssh/ssh_host_rsa_key

HostKey /etc/ssh/ssh_host_dsa_key

HostKey /etc/ssh/ssh_host_ecdsa_key

HostKey /etc/ssh/ssh_host_ed25519_key

更改,允许root用户登录

PermitRootLogin yes

允许无密码登录

PermitEmptyPasswords yes

另外

sshd放入

新建文件夹 /usr/local/openssh/bin

将相关可执行文件放入上边那个文件夹下

改动 /etc/profile 中的 PATH,后边追加:/usr/local/openssh/bin

在start_program.sh中添加

/usr/local/openssh/bin/sshd -f /etc/ssh/sshd_config

 

 

 

 

 

在itop4412上移植SSH,你可以按照以下步骤进行操作: 1. 首先,将SSH源代码拷贝到itop4412的开发环境中。你可以使用SCP命令将源代码从本地计算机复制到itop4412上的指定目录。例如,将源代码复制到itop4412的`/home/project/ssh-arm/openssh-4.6p1`目录下: ```shell scp /path/to/openssh-4.6p1.tar.gz root@itop4412:/home/project/ssh-arm/ ``` 2. 解压源代码文件。在itop4412上的开发环境中,使用以下命令解压源代码文件: ```shell tar -zxvf openssh-4.6p1.tar.gz ``` 3. 进入解压后的源代码目录: ```shell cd openssh-4.6p1 ``` 4. 配置编译选项。运行以下命令以配置SSH的编译选项: ```shell ./configure --host=arm-linux-gnueabihf --prefix=/usr/local/ssh ``` 这里的`--host`选项指定了目标平台为arm-linux-gnueabihf,`--prefix`选项指定了安装目录为`/usr/local/ssh`。 5. 编译源代码。运行以下命令以编译SSH源代码: ```shell make ``` 6. 安装SSH。运行以下命令以将编译后的SSH安装到指定目录: ```shell make install ``` 这将把SSH安装到`/usr/local/ssh`目录下。 7. 配置SSH服务器。在itop4412上的开发环境中,编辑SSH服务器的配置文件`/usr/local/ssh/etc/sshd_config`,根据你的需求进行配置。 8. 启动SSH服务器。运行以下命令以启动SSH服务器: ```shell /usr/local/ssh/sbin/sshd ``` 现在,你已经成功在itop4412上移植SSH,并启动了SSH服务器。你可以使用SSH客户端连接到itop4412并进行远程操作。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值