最近搞项目遇到一个问题,离线安装ssh,上网找了很多资料。参考了这个大佬的方案


https://www.cnblogs.com/jiguibu/p/18713791。

最终整理了一下结果,并实验成功。

 一定要下同一个版本的比如我的:8.2p1-4。 ubuntu为22.04。 下载地址为:https://mirrors.aliyun.com/ubuntu/pool/main/o/openssh

需要下载三个文件,1.openssh-client_8.2p1-4_amd64.deb 2.openssh-server_8.2p1-4_amd64.deb 3.openssh-sftp-server_8.2p1-4_amd64.deb  以及:libssl1.1_1.1.1-1ubuntu2.1~18.04.23_amd64.deb。其中 libssl1.1_1.1.1-1ubuntu2.1~18.04.23_amd64.deb为安装ssh-client的必要组件,ssh-client是安装.openssh-server和openssh-sftp-server的必要组件。

 

 

 

具体步骤:

 

1..将三个ssh包复制 one(你自己的) 目录下

以root的身份执行:

dpkg -i libssl1.1_1.1.1-1ubuntu2.1~18.04.23_amd64.deb
在执行: dekg -i openssh-*.deb

2.启动ssh服务

systemctl start ssh

 

 

3.查看状态
systemctl status ssh

4.开机自启

sysemctl enable ssh

 

顺便修改下ssh登陆权限:

以root更改/etc/ssh/sshd_config

chmod 777 /etc/ssh/sshd_config

将里面的:

找到#LoginGraceTime 2m那一行

全部改成:
#LoginGraceTime 2m
PermitRootLogin yes
StrictModes yes
MaxAuthTries 6
MaxSessions 10
在使用 ssh登陆即可

重启ssh服务
systemctl restart ssh