关于git的ssh permission denied原因汇总
SSH关于公钥认证Permission denied (publickey,gssapi-with-mic的问题
http://h2appy.blog.51cto.com/609721/1112797
CentOS 6.3系统下,用户user的home目录:/home/user的权限变成了777,造成不能正常登陆SSH,报如下错误:Permission denied (publickey,gssapi-with-mic
SSH对公钥、私钥的权限和所有权的要求是非常严格的,总结如下:
1、下面两个目录的所有权必须是user,所属组也应该是user,权限必须为700
\home\user
\home\user\.ssh
2、下面公钥文件的所有权必须是user,所属组也应该是user,权限必须为644
\home\user\.ssh\authorized_keys
3、下面私钥文件的所有权必须是user,所属组也应该是user,权限必须是600
\home\user\.ssh\id_rsa
ssh使用公钥授权不通过的问题解决
http://www.2cto.com/os/201206/137286.html
OpenSSH 无密码访问配置
http://www.linuxidc.com/Linux/2012-06/62932.htm
Ubuntu下OpenSSH的安装:
sudo apt-get install openssh-server
一、问题描述
假设 A 为客户机器,B为目标机;
要达到的目的:
A机器ssh登录B机器无需输入密码;
加密方式选 rsa|dsa均可以,默认dsa
二、具体操作流程
单向登陆的操作过程(能满足上边的目的):
1、登录A机器
2、ssh-keygen -t [rsa|dsa],将会生成密钥文件和私钥文件 id_rsa,id_rsa.pub或id_dsa,id_dsa.pub
3、将 .pub 文件复制到B机器的 .ssh 目录, 并 cat id_dsa.pub > ~/.ssh/authorized_keys
4、大功告成,从A机器登录B机器的目标账户,不再需要密码了;(直接运行 #ssh 192.168.20.60 )
双向登陆的操作过程:
1、ssh-keygen做密码验证可以使在向对方机器上ssh ,scp不用使用密码.具体方法如下:
2、两个节点都执行操作:#ssh-keygen -t rsa
然后全部回车,采用默认值.
3、这样生成了一对密钥,存放在用户目录的~/.ssh下。
将公钥考到对方机器的用户目录下 ,并将其复制到~/.ssh/authorized_keys中(操作命令:#cat id_dsa.pub >> ~/.ssh/authorized_keys )。
4、设置文件和目录权限:
设置authorized_keys权限
$ chmod 600 authorized_keys
设置.ssh目录权限
$ chmod 700 -R .ssh
5、要保证.ssh和authorized_keys都只有用户自己有写权限。否则验证无效。(今天就是遇到这个问题,找了好久问题所在),其实仔细想想,这样做是为了不会出现系统漏洞。
我从20.60去访问20.59的时候会提示如下错误:
The authenticity of host '192.168.20.59 (192.168.20.59)' can't be established. RSA key fingerprint is 6a:37:c0:e1:09:a4:29:8d:68:d0:ca:21:20:94:be:18. Are you sure you want to continue connecting (yes/no)? yes Warning: Permanently added '192.168.20.59' (RSA) to the list of known hosts. root@192.168.20.59's password: Permission denied, please try again. root@192.168.20.59's password: Permission denied, please try again. root@192.168.20.59's password: Permission denied (publickey,gssapi-with-mic,password).
三、总结
1、文件和目录的权限千万别设置成chmod 777.这个权限太大了,不安全,数字签名也不支持。
2、生成的rsa/dsa签名的公钥是给对方机器使用的,这个公钥内容还要拷贝到authorized_keys
3、linux之间的访问直接 ssh 机器ip4、某个机器生成自己的RSA或者DSA的数字签名,将公钥给目标机器,然后目标机器接收后设定相关权限(公钥和authorized_keys权限),这个目标机就能被访问了!
SSH : Permission denied(publickey,gssapi-with-mic)
http://blog.csdn.net/ashlingr/article/details/7670338
在搭载Hadoop集群过程中,涉及到 配置SSH使用无密码公钥认证,遇到了SSH : Permission denied (publickey,gssapi-with-mic)错误。现将解决方式记录下:(由于解决问题的时间和过程过长,有可能会缺少了其中一些步骤,仅供参考)
最终找到的错误原因:为了保证sshd_config的配置一致性,在普通用户下,登录root,从另外一台机子上将/etc/ssh文件夹中的sshd_config拷贝到这台机子上。但是这样的操作会改变sshd_config的权限,在ls命令下看到文件变为绿色,与其他配置文件不同,再用“ls -al”查看,sshd_config权限为“-rw-r--r-- ”,将其改为“-rw------- ”,即可。命令:chmod 600 sshd_config。
另外:authorized_keys 的权限为“-rw-------”,即600。
最后,sshd_config配置文件如下:
# $OpenBSD: sshd_config,v 1.73 2005/12/06 22:38:28 reyk Exp $
# This is the sshd server system-wide configuration file. See
# sshd_config(5) for more information.
# This sshd was compiled with PATH=/usr/local/bin:/bin:/usr/bin
# The strategy used for options in the default sshd_config shipped with
# OpenSSH is to specify options with their default value where
# possible, but leave them commented. Uncommented options change a
# default value.
#Port 22
#Protocol 2,1
Protocol 2
#AddressFamily any
#ListenAddress 0.0.0.0
#ListenAddress ::
# HostKey for protocol version 1
#HostKey /etc/ssh/ssh_host_key
# HostKeys for protocol version 2
#HostKey /etc/ssh/ssh_host_rsa_key
#HostKey /etc/ssh/ssh_host_dsa_key
# Lifetime and size of ephemeral version 1 server key
#KeyRegenerationInterval 1h
#ServerKeyBits 768
# Logging
# obsoletes QuietMode and FascistLogging
#SyslogFacility AUTH
SyslogFacility AUTHPRIV
#LogLevel INFO
# Authentication:
#LoginGraceTime 2m
#PermitRootLogin yes
#PermitRootLogin yes
#StrictModes yes
#MaxAuthTries 6
#RSAAuthentication yes
#PubkeyAuthentication yes
#PubkeyAuthentication no
#AuthorizedKeysFile .ssh/authorized_keys
# For this to work you will also need host keys in /etc/ssh/ssh_known_hosts
#RhostsRSAAuthentication no
# similar for protocol version 2
#HostbasedAuthentication no
# Change to yes if you don't trust ~/.ssh/known_hosts for
# RhostsRSAAuthentication and HostbasedAuthentication
#IgnoreUserKnownHosts no
# Don't read the user's ~/.rhosts and ~/.shosts files
#IgnoreRhosts yes
# To disable tunneled clear text passwords, change to no here!
#PasswordAuthentication yes
#PermitEmptyPasswords no
#PasswordAuthentication yes
PasswordAuthentication no
AuthorizedKeysFile .ssh/authorized_keys
# Change to no to disable s/key passwords
#ChallengeResponseAuthentication yes
ChallengeResponseAuthentication no
# Kerberos options
#KerberosAuthentication no
#KerberosOrLocalPasswd yes
#KerberosTicketCleanup yes
#KerberosGetAFSToken no
# GSSAPI options
#GSSAPIAuthentication no
GSSAPIAuthentication yes
#GSSAPICleanupCredentials yes
GSSAPICleanupCredentials yes
# Set this to 'yes' to enable PAM authentication, account processing,
# and session processing. If this is enabled, PAM authentication will
# be allowed through the ChallengeResponseAuthentication mechanism.
# Depending on your PAM configuration, this may bypass the setting of
# PasswordAuthentication, PermitEmptyPasswords, and
# "PermitRootLogin without-password". If you just want the PAM account and
# session checks to run without PAM authentication, then enable this but set
# ChallengeResponseAuthentication=no
#UsePAM no
UsePAM yes
# Accept locale-related environment variables
AcceptEnv LANG LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY LC_MESSAGES
AcceptEnv LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE LC_MEASUREMENT
AcceptEnv LC_IDENTIFICATION LC_ALL
#AllowTcpForwarding yes
#GatewayPorts no
#X11Forwarding no
X11Forwarding yes
#X11DisplayOffset 10
#X11UseLocalhost yes
#PrintMotd yes
#PrintLastLog yes
#TCPKeepAlive yes
#UseLogin no
#UsePrivilegeSeparation yes
#PermitUserEnvironment no
#Compression delayed
#ClientAliveInterval 0
#ClientAliveCountMax 3
#ShowPatchLevel no
#UseDNS yes
#PidFile /var/run/sshd.pid
#MaxStartups 10
#PermitTunnel no
#ChrootDirectory none
# no default banner path
#Banner /some/path
# override default of no subsystems
Subsystem sftp /usr/libexec/openssh/sftp-server
SSH 登录是错误:Permission denied (publickey,gssapi-with-mic)
http://www.oschina.net/question/54100_28922
$ ssh root@192.168.xx.xx
Permission denied (publickey,gssapi-with-mic).
报了这么个错,原因是我上次做测试时修改了/etc/ssh/sshd_config 中的"PasswordAuthentication"参数值为"no",修改回"yes",重启sshd服务即可。
git@osc 上传公钥总是失败的问题
http://my.oschina.net/230/blog/145883
复制公钥到http://git.oschina.net/keys里时提示:
- Key can't be fingerprinted
或者提示:
- Key 是无效的
这都是文本格式问题,因为我都是在终端使用命令:
cat ~/.ssh/id_rsa.pub
获取然后复制过去的,即使去掉了复制过程中而外的空格,还是提示上诉错误。
另外在文本编辑器中打开,然后c-a,c-c,复制过去就可以了,,
:-)
笔记~SSH无需密码密钥登录,centos 5.5 下成功
http://my.oschina.net/emptytimespace/blog/79173
SSH公钥无密码认证
http://my.oschina.net/heartdong/blog/135374
1)在master主机上生成密码对
1 |
ssh -keygen –t rsa –P '' |
确认一路回车,命令默认会在用户主目录下生成.ssh目录,你们有两 密钥对文件:id_rsa和id_rsa.pub
1 |
[master@hadoop ~]$ ll . ssh / |
2 |
-rw-------. 1 master master 1675 Jun 3 00:28 id_rsa |
3 |
-rw-r--r--. 1 master master 402 Jun 3 00:28 id_rsa.pub |
接着在master节点上做如下配置,把id_rsa.pub追加到授权的key里面去。
1 |
cat ~/. ssh /id_rsa.pub >> ~/. ssh /authorized_keys |
本以为这么就可以搞定了的,发现输入命令ssh localhost还是要密码。
捣鼓了半天,终于还是被我找到了原因
找到服务器修改SSH配置文件"/etc/ssh/sshd_config",修改如下内容(去掉前面的注释)
1 |
RSAAuthentication yes # 启用 RSA 认证 |
2 |
PubkeyAuthentication yes # 启用公钥私钥配对认证方式 |
3 |
AuthorizedKeysFile . ssh /authorized_keys # 公钥文件路径(和上面生成的文件同) |
设置完之后记得 重启SSH服务
1 |
service sshd restart |
重新验证ssh localhost,无密码登陆成功
配置远程登陆其他机器也是同一个原理,只需把本机生成的id_rsa.pub上传到其他服务器做同样操作即可。
ssh: permission denied (publickey)
http://www.blogjava.net/dongbule/archive/2011/01/04/342275.html
ssh出现permission denied (publickey)问题:
修改/etc/ssh/sshd-config文件.
将其中的PermitRootLogin no修改为yes
PubkeyAuthentication yes修改为no
AuthorizedKeysFile .ssh/authorized_keys前面加上#屏蔽掉,
PasswordAuthentication no修改为yes就可以了。 vi /etc/ssh/sshd-config (详细说说sshd-config的配置解释)
Port 22
Protocol 2
PermitRootLogin no
PubkeyAuthentication yes
AuthorizedKeysFile .ssh/authorized_keys
#CACertificateFile /etc/ssh/ca/ca.cert
PasswordAuthentication no
PermitEmptyPasswords no
PrintMotd no
ChallengeResponseAuthentication no
UseDNS no
ClientAliveInterval 60
Port 22 # SSH 预设使用 22 这个 port,您也可以使用多的 port !亦即重复使用 port 这个设定项目即可! Protocol 2 # 选择的 SSH 协议版本,可以是 1 也可以是 2 ,如果要同时支持两者,就必须要使用 2,1 这个分隔了
PermitRootLogin no # 是否允许 root 登入!预设是允许的,但是建议设定成 no! PubkeyAuthentication yes # 是否允许 Public Key AuthorizedKeysFile .ssh/authorized_keys # 上面这个在设定若要使用不需要密码登入的账号时,那么那个账号的存放档案所在档名! PasswordAuthentication no # 是否需要密码的验证 PermitEmptyPasswords no # 若上面那一项如果设定为 yes 的话,这一项就最好设定为 no ,这个项目在是否允许以空的密码登入!当然不许! PrintMotd no # 登入后是否显示出一些信息呢?例如上次登入的时间、地点等 ChallengeResponseAuthentication no # 是否启用其它的 PAM 模块!启用这个模块将会导致 PasswordAuthentication 设定失效! UseDNS no ClientAliveInterval 60
ssh使用公钥授权不通过的问题解决
http://www.2cto.com/os/201206/137286.html
关于git的ssh permission denied原因汇总的更多相关文章
- github:当你想要使用VSCODE开心提交代码时,出现Git:git@github.com:Permission denied(publickey)解决方案
当你想要使用VSCODE开心提交代码时,出现Git:git@github.com:Permission denied(publickey)弹框 图片: 原因:电脑公钥(publickey)未添加至gi ...
- git@github.com: Permission denied (publickey).////remote: Permission to xxx/test.git denied to xxx.等权限问题
Error msg git@github.com: Permission denied (publickey) 或者: remote: Permission to xxx/test.git denie ...
- Failed to connect to the host via ssh: Permission denied (publickey,gssapi-keyex,gssapi-with-mic,password
Centos7.5 执行ansible命令报错 问题: [root@m01 ~]# ansible servers -a "hostname" -i ./hosts -u root ...
- 使用Git出现以下错误"Git@github.com: Permission denied (publickey). Could not read from remote repository."解决方案
转载于:https://blog.csdn.net/dotphoenix/article/details/100130424 git@github.com: Permission denied (pu ...
- git实战中遇到git@github.com: Permission denied (publickey).的问题
一.问题我们在使用git的时候会建立一个私钥和一个公钥来完成彼此的通讯,因此如何使用给一个指令建立一个秘钥至关重要.但是我在实践的过程中出现了git@github.com: Permission de ...
- ubuntu下git clone 出现Permission denied (publickey).
今天在ubuntu上使用git 克隆 github上面的库,一直权限拒绝Permission denied (publickey). 公钥绑了好几次,都不行: 最后怀疑是git配置公钥地址有问题:打开 ...
- 【git基础】Permission denied (publickey). fatal: Could not read from remote repository
运行以下git命令的时候出现错误 git push -u origin master error The authenticity of host 'github.com (13.250.177.22 ...
- IDEA中使用git报错Permission denied (publickey)
最近在使用idea开发时,使用git拉取远程仓库的代码时,报错Permission denied (publickey),原因是因为ssh的密钥失效,必须得重新设置下ssh的密钥即可. 命令很简单,在 ...
- git 时 出现 Permission denied (publickey).
https://blog.csdn.net/awp0011/article/details/73368481 第一次使用github.com在本地 执行 git clone git@github.co ...
随机推荐
- 22.Mysql磁盘I/O
22.磁盘I/O问题磁盘IO是数据库性能瓶颈,一般优化是通过减少或延缓磁盘读写来减轻磁盘IO的压力及其对性能的影响.增强磁盘读写性能和吞吐量也是重要的优化手段. 22.1 使用磁盘阵列 RAID(Re ...
- CSS学习总结1:CSS样式
1.CSS背景 属性 background-color:为元素设置背景色,值可以是任何合法的颜色值.实例:p {background-color: gray;} background-image:为元 ...
- 4A - 排序
输入一行数字,如果我们把这行数字中的‘5’都看成空格,那么就得到一行用空格分割的若干非负整数(可能有些整数以‘0’开头,这些头部的‘0’应该被忽略掉,除非这个整数就是由若干个‘0’组成的,这时这个整数 ...
- Vim中如何使用正则进行搜索
#set magic这句的作用在于将vim的正则打开. 这样就可以搜索了. 至于正则的相关的内容.在此抄一份.以免于下次自己还要去百度. 符号 匹配 . (dot) 任意单一字符 \d 任意一位数字 ...
- 深入研究 UCenter API For .NET
康盛旗下产品的搭建 来自http://www.dozer.cc/2011/02/ucenter-api-in-depth-4th/ 1.UCenter 这个当然是最基本的东西,安装起来也很简单,官方就 ...
- MySQL自带的4个数据库
安装完 MySQL 后会发现有四个自带的数据库: information_schema -- 该数据库保存了 MySQL 服务器所有数据库的信息.比如数据库的名称.数据库中的表名称.访问权限.数据库中 ...
- 存储过程和函数 PROCEDURE & FUNCTION
SQL语句执行的时候,要首先编译,然后在被执行.在大型数据库系统中,为了提高效率,将为了完成特定功能的SQL语句集进行编译优化后,存储在数据库服务器中,用户通过指定存储过程的名字来调用执行. 具体而言 ...
- python之排列组合测试
# test permutations and combinations import itertools as it for i in it.combinations('abcd',2): prin ...
- java 中jar的使用
????????????这里不会 需要学习
- CollisionFlags
CollisionFlags是CharactorController的返回值,表示碰撞的信息 Values: None Sides Above Below function Update () { v ...