一次gitlab无法使用ssh登录的问题解决

当尝试通过ssh登录gitlab时遇到Permission denied错误,本文详细描述了问题排查过程。首先确认本地ssh密钥配置无误,然后发现gitlab-shell的config.yml文件权限异常,属主为root。修改文件权限并重启服务后,ssh登录恢复正常,揭示了ssh登录对文件权限的严格要求。
摘要由CSDN通过智能技术生成

故障现象:

[root@web-m data]# git clone ssh://git@gitlab.lixinkuan.com:22022/lxk/core.git
Cloning into 'core'...
git@gitlab.lixinkuan.com's password: 
Permission denied, please try again.
git@gitlab.lixinkuan.com's password: 
Permission denied, please try again.
git@gitlab.lixinkuan.com's password: 
Permission denied (publickey,gssapi-keyex,gssapi-with-mic,password).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights
and the repository exists.

本地已经创建密钥并把私钥传至用户 SSH Keys中,操作过程没问题,但是只能通过http方式输入用户名密码登录。

提示中Permission denied已表明是权限问题,因为ssh登录时不能用密码登录,无论输入的密码是不是正确,都会提示Permission denied。debug模式下查看登录过程:

[root@web-m .ssh]# ssh -vT git@gitlab.lixinkuan.com -p 22022
OpenSSH_7.4p1, OpenSSL 1.0.2k-fips  26 Jan 2017
debug1: Reading configuration data /etc/ssh/ssh_config
debug1: /etc/ssh/ssh_config line 58: Applying options for *
debug1: Connecting to gitlab.lixinkuan.com [X.X.X.X] port 22022.
debug1: Connection established.
debug1: permanently_set_uid: 0/0
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/id_rsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/id_rsa-cert type -1
debug1: identity file /root/.ssh/id_dsa type 2
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/id_dsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/id_ecdsa type -1
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/id_ecdsa-cert type -1
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/id_ed25519 type -1
debug1: key_load_public: No such file or directory
debug1: identity file /root/.ssh/id_ed25519-cert type -1
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_7.4
debug1: Remote protocol version 2.0, remote software version OpenSSH_5.3
debug1: match: OpenSSH_5.3 pat OpenSSH_5* compat 0x0c000000
debug1: Authenticating to gitlab.lixinkuan.com:22022 as 'git'
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: algorithm: diffie-hellman-group-exchange-sha256
debug1: kex: host key algorithm: ssh-rsa
debug1: kex: server->client cipher: aes128-ctr MAC: umac-64
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值