升级openssh反馈git clone 需要输入密码

升级gitlab主机的版本:OpenSSH_8.0p1 ,导致远端的服务器无法通过sftp传输文件到gitlab服务器,发现是远端的服务器ssh版本太低,而新升级版本OpenSSH_8.0p1的服务器已经不再支持老版本ssh client的相关协议,这时候有两种解决办法,一种是升级远端服务器的openssh client版本,一种是修改升级后的服务器配置文件使其支持旧版本的协议,当然采用第二种方法自己解决问题。

查看openssh支持的协议

sshd -T | grep kex
kexalgorithms curve25519-sha256,curve25519-sha256@libssh.org,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group16-sha512,diffie-hellman-group18-sha512,diffie-hellman-group14-sha256,diffie-hellman-group14-sha1

修改配置文件为如下所示:

#vim /etc/ssh/sshd_config

KexAlgorithms diffie-hellman-group1-sha1,diffie-hellman-group14-sha1,diffie-hellman-group-exchange-sha1,diffie-hellman-group-exchange-sha256,ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group1-sha1,curve25519-sha256@libssh.org

重启sshd:

#service sshd restart

基本上到这里就解决问题了。
也记录一下如果还有问题的排查

确认ssh公钥已经上传到gitlab密钥之后,查看一下git用户是否被锁定

执行命令:sudo passwd -u git
强制执行命令:sudo passwd -u -f git

[root@hostname ~]# sudo passwd -u git
Unlocking password for user git.
passwd: Warning: unlocked password would be empty.
passwd: Unsafe operation (use -f to force)
[root@hostname ~]# sudo passwd -u -f git
Unlocking password for user git.
passwd: Success

在尝试执行命令:
#git clone git@gitlab.xxx.com:weiliyan/test.git
就可以免密远程下载项目到本地了

本文参考:
https://blog.csdn.net/duanbiren123/article/details/103034914
https://www.cnblogs.com/shansongxian/p/6616954.html

  • 1
    点赞
  • 2
    收藏
    觉得还不错? 一键收藏
  • 1
    评论
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值