1.去ssh官网或者阿里源下载最新版本的源码

官网:OpenSSH: Portable Release

阿里:https://mirrors.aliyun.com/pub/OpenBSD/OpenSSH/portable/

 2.将压缩包上传到不能联网的服务器(想办法上传,解压tar包并进入

tar -zxvf 包名

cd 包名

3. 通过源码编译安装ssh

(1) ./configure --prefix=/opt --sysconfdir=/etc/ssh

         #让配置文件在/etc/ssh下

(2)make

  (3)   make install

4. 出现问题 

 Privilege separation user sshd does not exist

解决办法:

在/etc/passwd 里面增加一行

sshd:x:74:74:Privilege-separated SSH:/var/empty/sshd:/sbin/nologin

在/etc/shadow 里加一行

sshd:!!:12506:0:99999:7::: 

5. 然后重新编译安装,完成后使用ssh -V 查看版本

 可以去/etc/ssh/sshd.config更改相关配置

6. 启动重启ssh服务

sudo /etc/init.d/ssh restart

sudo /etc/init.d/ssh start

sudo /etc/init.d/ssh.dpkg-new

sudo service sshd restart

以上命令哪个能用用哪个 

Logo

为开发者提供学习成长、分享交流、生态实践、资源工具等服务,帮助开发者快速成长。

更多推荐