[parallels@localhost ~]$ ssh-keygen -t rsa -C ‘1012144290@qq.com’
Generating public/private rsa key pair.
Enter file in which to save the key (/home/parallels/.ssh/id_rsa):
/home/parallels/.ssh/id_rsa already exists.
Overwrite (y/n)? y
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /home/parallels/.ssh/id_rsa.
Your public key has been saved in /home/parallels/.ssh/id_rsa.pub.
The key fingerprint is:
SHA256:Ke2QA9DdBQkezUxbxr2LrUJsvDpp7WowUEmZ87poKtY ‘1012144290@qq.com’
The key's randomart image is:

[root@localhost .ssh]# ssh -T -v git@github.com
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 github.com [13.250.177.223] port 22.
debug1: Connection established.
debug1: permanently_set_uid: 0/0
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: key_load_public: No such file or directory
debug1: identity file /root/.ssh/id_dsa type -1
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 babeld-d410d4f8
debug1: no match: babeld-d410d4f8
debug1: Authenticating to github.com:22 as 'git'
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: algorithm: curve25519-sha256
debug1: kex: host key algorithm: rsa-sha2-512
debug1: kex: server->client cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
debug1: kex: client->server cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
debug1: kex: curve25519-sha256 need=64 dh_need=64
debug1: kex: curve25519-sha256 need=64 dh_need=64
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ssh-rsa SHA256:nThbg6kXUpJWGl7E1IGOCspRomTxdCARLviKw6E5SY8
debug1: Host 'github.com' is known and matches the RSA host key.
debug1: Found key in /root/.ssh/known_hosts:1
debug1: rekey after 134217728 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: rekey after 134217728 blocks
debug1: SSH2_MSG_EXT_INFO received
debug1: kex_input_ext_info: server-sig-algs=<ssh-ed25519-cert-v01@openssh.com,ecdsa-sha2-nistp521-cert-v01@openssh.com,ecdsa-sha2-nistp384-cert-v01@openssh.com,ecdsa-sha2-nistp256-cert-v01@openssh.com,sk-ssh-ed25519-cert-v01@openssh.com,sk-ecdsa-sha2-nistp256-cert-v01@openssh.com,rsa-sha2-512-cert-v01@openssh.com,rsa-sha2-256-cert-v01@openssh.com,ssh-rsa-cert-v01@openssh.com,ssh-dss-cert-v01@openssh.com,sk-ssh-ed25519@openssh.com,sk-ecdsa-sha2-nistp256@openssh.com,ssh-ed25519,ecdsa-sha2-nistp521,ecdsa-sha2-nistp384,ecdsa-sha2-nistp256,rsa-sha2-512,rsa-sha2-256,ssh-rsa,ssh-dss>
^C
[root@localhost .ssh]#

[root@localhost .ssh]# ssh -i /home/parallels/.ssh/id_rsa.pub. -vT git@github.com
Warning: Identity file /home/parallels/.ssh/id_rsa.pub. not accessible: No such file or directory.
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 github.com [13.229.188.59] port 22.
debug1: Connection established.
debug1: permanently_set_uid: 0/0
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: key_load_public: No such file or directory
debug1: identity file /root/.ssh/id_dsa type -1
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 babeld-d410d4f8
debug1: no match: babeld-d410d4f8
debug1: Authenticating to github.com:22 as 'git'
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: algorithm: curve25519-sha256
debug1: kex: host key algorithm: rsa-sha2-512
debug1: kex: server->client cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
debug1: kex: client->server cipher: chacha20-poly1305@openssh.com MAC: <implicit> compression: none
debug1: kex: curve25519-sha256 need=64 dh_need=64
debug1: kex: curve25519-sha256 need=64 dh_need=64
debug1: expecting SSH2_MSG_KEX_ECDH_REPLY
debug1: Server host key: ssh-rsa SHA256:nThbg6kXUpJWGl7E1IGOCspRomTxdCARLviKw6E5SY8
debug1: Host 'github.com' is known and matches the RSA host key.
debug1: Found key in /root/.ssh/known_hosts:1
debug1: rekey after 134217728 blocks
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: rekey after 134217728 blocks
debug1: SSH2_MSG_EXT_INFO received
debug1: kex_input_ext_info: server-sig-algs=<ssh-ed25519-cert-v01@openssh.com,ecdsa-sha2-nistp521-cert-v01@openssh.com,ecdsa-sha2-nistp384-cert-v01@openssh.com,ecdsa-sha2-nistp256-cert-v01@openssh.com,sk-ssh-ed25519-cert-v01@openssh.com,sk-ecdsa-sha2-nistp256-cert-v01@openssh.com,rsa-sha2-512-cert-v01@openssh.com,rsa-sha2-256-cert-v01@openssh.com,ssh-rsa-cert-v01@openssh.com,ssh-dss-cert-v01@openssh.com,sk-ssh-ed25519@openssh.com,sk-ecdsa-sha2-nistp256@openssh.com,ssh-ed25519,ecdsa-sha2-nistp521,ecdsa-sha2-nistp384,ecdsa-sha2-nistp256,rsa-sha2-512,rsa-sha2-256,ssh-rsa,ssh-dss>
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Offering RSA public key: /root/.ssh/id_rsa
debug1: Authentications that can continue: publickey
debug1: Trying private key: /root/.ssh/id_dsa
debug1: Trying private key: /root/.ssh/id_ecdsa
debug1: Trying private key: /root/.ssh/id_ed25519
debug1: No more authentication methods to try.
Permission denied (publickey).

Permissions 0644 for '/root/.ssh/id_rsa.pub' are too open

WaldeinCheng 2018-11-12 10:27:54 2092 收藏
分类专栏: Bugs 文章标签: Centos git ssh
版权
今天在进行向ssh-agent服务中添加git密钥时,出现下面错误

Permissions 0644 for '/root/.ssh/id_rsa.pub' are too open.
It is required that your private key files are NOT accessible by others.
This private key will be ignored.
1
2
3
根据翻译应该是权限太大,访问太过随意,ssh自身的安全策略把我的操作命令拒绝了
修改把权限降低即可

chmod 0600 ~/.ssh/id_rsa.pub
1
解决,nice!
————————————————
版权声明:本文为CSDN博主「WaldeinCheng」的原创文章,遵循CC 4.0 BY-SA版权协议,转载请附上原文出处链接及本声明。
原文链接:https://blog.csdn.net/qq_34691713/article/details/83987873

Posts - 27  Articles - 1  Comments - 0  Views - 29150 

git操作常见错误处理

 

1.Error:The authenticity of host 'github.com (192.30.255.112)' can't be established.

Git密钥认证github时出现如下错误:
 
$ ssh -T git@github.com
The authenticity of host 'github.com (192.30.255.112)' can't be established.
RSA key fingerprint is SHA256:nThbg6kXUpJWGl7E1IGOCspRomTxdCARLviKY8.
Are you sure you want to continue connecting (yes/no)?1234
解决方法: 
直接输入 yes 回车,这时在ssh目录下除id_rsa,id_rsa.pub文件外,还会生成一个know_hosts 文件。
 
$ ssh git@github.com
PTY allocation request failed on channel 0
You've successfully authenticated, but GitHub does not provide shell access.
Connection to github.com closed.
 
2.git连接拒绝
ssh -T git@github.com
[root@control-compute00 nova]# ssh-add
Could not open a connection to your authentication agent.
[root@control-compute00 nova]# ssh-agent bash
[root@control-compute00 nova]# ssh-add -l
The agent has no identities.
[root@control-compute00 nova]#  ssh-add ~/.ssh/id_rsa
Identity added: /root/.ssh/id_rsa (/root/.ssh/id_rsa)
 
 
https://docs.github.com/en/github/authenticating-to-github/troubleshooting-ssh/error-permission-denied-publickey
 
 
 

各文件夹权限均是正确的。经查因seLinux设置问题:

在被远程服务器的seLinux上关闭

getenforce查看当前模式。如果为disabled即是关闭状态。

vi /etc/selinux/config打开selinux配置文件

保存即可。

最新文章

  1. ReactJS入门(一)—— 初步认识React
  2. Maven命令行使用:mvn clean package(打包)
  3. [原创]java WEB学习笔记109:Spring学习---spring中事物管理
  4. 全架构PaaS TAE 2.0的Docker实践
  5. JQuery对象操作支持链式法则源码分析
  6. oracle监听服务无法打开
  7. Oracle中sql的基本使用
  8. python之第一个例子hello world
  9. MKMapView移动事件地图
  10. push控制器 卡顿
  11. 东正王增涛浅析OA信息化整合平台系统在企业中的应用价值
  12. vue.js实战——升级版购物车
  13. ipset 教程
  14. 七、UIViewController导航栏
  15. 51nod 1766 树上的最远点对 | LCA ST表 线段树 树的直径
  16. QtGui.QPen
  17. mybatis插入返回主键
  18. FireDAC的SQLite初探
  19. Epoll模型讲解
  20. 查询相应的key

热门文章

  1. wordpress宕机原因及处理方法
  2. vscode注释插件
  3. org.elasticsearch.ElasticsearchException: not all primary shards of [.geoip_databases] index are active解决办法
  4. 框架和Nginx
  5. 看图王 10.9.1.9791 With X64 去广告绿色版
  6. k8s安装metrics-server
  7. react toolkit 异步请求之后调取其他函数
  8. TM1621断码液晶驱动IC的原理、驱动代码
  9. c--&gt; #define 定义宏
  10. 25js String(字符串)对象