备份pam.d/sshd文件:
cp /etc/pam.d/sshd /etc/pam.d/sshdbak
安装前,可以多开几个ssh窗口,也可以开启telnet服务,防止意外中断无法访问服务器
rpm -e openssh --nodeps
rpm -e openssh-server --nodeps
rpm -e openssh-clients --nodeps
rpm -e openssh-askpass --nodeps
安装新版本
rpm -ivh openssh-9.2p1-1.el6.x86_64.rpm
rpm -ivh openssh-clients-9.2p1-1.el6.x86_64.rpm
rpm -ivh openssh-server-9.2p1-1.el6.x86_64.rpm
rpm -ivh openssh-askpass-9.2p1-1.el6.x86_64.rpm
完成安装后:
恢复 /etc/pam.d/sshd文件
cat /etc/pam.d/sshdbak > /etc/pam.d/sshd
vi /etc/ssh/sshd_config
PermitRootLogin yes
或者:
sed -i 's|#PermitRootLogin prohibit-password|PermitRootLogin yes|g' /etc/ssh/sshd_config
sed -i 's|#UsePAM no|UsePAM yes|g' /etc/ssh/sshd_config
sed -i 's|#UseDNS yes|UseDNS no|g' /etc/ssh/sshd_config
sed -i 's|#MaxStartups 10:30:100|MaxStartups 1000:30:3000|g' /etc/ssh/sshd_config
//sed -i -r 's/^(.*pam_nologin.so)/#\1/' /etc/pam.d/sshd
#UseLogin no ,该参数不能设成yes
UsePAM yes ,该参数需要设成yes,不然ssh登陆后,ulimit设置不会生效
//然后:(不需要)
//rm -f /etc/ssh/ssh_host_ecdsa_key
//rm -f /etc/ssh/ssh_host_ed25519_key
//ssh-keygen -t rsa -f /etc/ssh/ssh_host_rsa_key -N ""
//ssh-keygen -t dsa -f /etc/ssh/ssh_host_dsa_key -N ""
//ssh-keygen -t rsa -f /etc/ssh/ssh_host_ecdsa_key -N ""
//ssh-keygen -t rsa -f /etc/ssh/ssh_host_ed25519_key -N ""
对于java客户端程序访问ssh server,升级新版本ssh后,会导致无法ssh,需要在/etc/ssh/sshd_config末尾添加配置(8.2版本开始必须添加):
cat >> /etc/ssh/sshd_config <<EOF
Ciphers 3des-cbc,aes128-cbc,aes192-cbc,aes256-cbc,aes128-ctr,aes192-ctr,aes256-ctr,aes128-gcm@openssh.com,aes256-gcm@openssh.com,chacha20-poly1305@openssh.com
MACs hmac-sha1,hmac-sha1-96,hmac-sha2-256,hmac-sha2-512,hmac-md5,hmac-md5-96,umac-64@openssh.com,umac-128@openssh.com,hmac-sha1-etm@openssh.com,hmac-sha1-96-etm@openssh.com,hmac-sha2-256-etm@openssh.com,hmac-sha2-512-etm@openssh.com,hmac-md5-etm@openssh.com,hmac-md5-96-etm@openssh.com,umac-64-etm@openssh.com,umac-128-etm@openssh.com
KexAlgorithms diffie-hellman-group1-sha1,diffie-hellman-group14-sha1,diffie-hellman-group14-sha256,diffie-hellman-group16-sha512,diffie-hellman-group18-sha512,diffie-hellman-group-exchange-sha1,diffie-hellman-group-exchange-sha256,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,curve25519-sha256,curve25519-sha256@libssh.org,sntrup761x25519-sha512@openssh.com
EOF
启动sshd服务:
service sshd start
查看支持的算法:
ssh -Q cipher
ssh -Q mac
ssh -Q kex
对于ssh连接有些网络设备:
ssh -oKexAlgorithms=+diffie-hellman-group1-sha1 -oCiphers=+aes256-cbc admin@x.x.x.x
方法一
使用-o选项增加选项(man ssh查看)
ssh -o KexAlgorithms=+diffie-hellman-group-exchange-sha1 -o HostKeyAlgorithms=+ssh-rsa username@hostname
方法二
在~/.ssh目录的下的config文件(文件不存在自行创建)中添加如下代码:
Host *
KexAlgorithms +diffie-hellman-group-exchange-sha1
HostKeyAlgorithms +ssh-rsa
————————————————
版权声明:本文为CSDN博主「MEZDE」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/qq_45924087/article/details/124494729
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![rpm](https://img-home.csdnimg.cn/images/20210720083646.png)
![tgz](https://img-home.csdnimg.cn/images/20210720083646.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![rpm](https://img-home.csdnimg.cn/images/20210720083646.png)
![7z](https://img-home.csdnimg.cn/images/20210720083312.png)
![gz](https://img-home.csdnimg.cn/images/20210720083447.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![gz](https://img-home.csdnimg.cn/images/20210720083447.png)
![gz](https://img-home.csdnimg.cn/images/20210720083447.png)
![rpm](https://img-home.csdnimg.cn/images/20210720083646.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![zip](https://img-home.csdnimg.cn/images/20210720083736.png)
![7z](https://img-home.csdnimg.cn/images/20210720083312.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
![rar](https://img-home.csdnimg.cn/images/20210720083606.png)
收起资源包目录
![package](https://csdnimg.cn/release/downloadcmsfe/public/img/package.f3fc750b.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/TXT.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
![file-type](https://csdnimg.cn/release/download/static_files/pc/images/minetype/UNKNOWN.png)
共 6 条
- 1
资源评论
![avatar-default](https://csdnimg.cn/release/downloadcmsfe/public/img/lazyLogo2.1882d7f4.png)
![avatar](https://profile-avatar.csdnimg.cn/default.jpg!1)
cxw1978caijf
- 粉丝: 1
- 资源: 52
上传资源 快速赚钱
我的内容管理 展开
我的资源 快来上传第一个资源
我的收益
登录查看自己的收益我的积分 登录查看自己的积分
我的C币 登录后查看C币余额
我的收藏
我的下载
下载帮助
![voice](https://csdnimg.cn/release/downloadcmsfe/public/img/voice.245cc511.png)
![center-task](https://csdnimg.cn/release/downloadcmsfe/public/img/center-task.c2eda91a.png)
安全验证
文档复制为VIP权益,开通VIP直接复制
![dialog-icon](https://csdnimg.cn/release/downloadcmsfe/public/img/green-success.6a4acb44.png)