ssh localhost “Permission denied (publickey)
再次遇到 SSH Server And “Permission denied (publickey)
用这个关键词搜索才找到howtogeek上答案: sshd : Authentication refused: bad ownership or modes for directory /
直接用我文章题目中的搜索,这次不管用。
看log
$ grep sshd /var/log/audit/audit.log
这个命令很有用。它会告诉你原因。
May 17 16:21:25 localhost sshd[30255]: Authentication refused: bad ownership or modes for directory /home/username
原因很清楚了。是目录权限不对。
方法是:
Fixing Authentication refused: bad ownership or modes for directoryFrom HowToGeekIf you get this error in your logs when trying to setup public key authenticated automatic logins, the problem is a permissions one.You’ll need to perform the following commands
on the user account you are trying to setup:
chmod go-w ~/
chmod 700 ~/.ssh
chmod 600 ~/.ssh/authorized_keys
http://www.howtogeek.com/wiki/Fixing_Authentication_refused:_bad_ownership_or_modes_for_directory
chmod go-w ~/ 这个很重要。如果你的用户目录被设定为其它用户和组用户可以写,那么即时你更改了 .ssh 目录和其文件也不管用!!!!! 我浪费了多少时间啊。 :( 我做了下面两步,但还是不行。 Permission denied (publickey).
Make sure you do the following:
Make sure the permissions of the .ssh folder are 0700Make sure the permissions of the authorized_keys file are 0600Make sure the user owns the .ssh folder and contents (normally that’s the case but just to make sure)http://blog.artooro.com/2010/02/19/ssh-server-and-permission-denied-publickey/
$ grep sshd /var/log/audit/audit.log
May 17 16:21:25 localhost sshd[30255]: Authentication refused: bad ownership or modes for directory /home/fltrpMay 17 16:21:35 localhost sshd[30257]: Authentication refused: bad ownership or modes for directory /home/fltrphttp://serverfault.com/questions/230771/ssh-configuration-publickeys-permission-denied-publickey-password-error
原文地址:
public-key生成命令(客户端)
# ssh-keygen -t dsa -f ~/.ssh/id_dsa
# cat ~/.ssh/id_dsa.pub >> ~/.ssh/authorized_keys
[注释:~/.ssh/id_dsa.pub文件为公钥,拷贝到Server的~/.ssh/目录中,执行cat ~/.ssh/id_dsa.pub >> ~/.ssh/authorized_keys,权限只给用户本人,否则无法连接]
允许root直接登录
编辑/etc/ssh/sshd_config, 重新启动sshd
PermitRootLogin yes
ssh localhost “Permission denied (publickey)的更多相关文章
- localhost: Permission denied (publickey,gssapi-keyex,gssapi-with-mic,password).
在开启hadoop时候报错:localhost: Permission denied (publickey,gssapi-keyex,gssapi-with-mic,password). 此时 ssh ...
- github windows配置以及ssh生成 Permission denied (publickey)
1:进入cmd命令下,或者可以使用GIt工具 (如果出现了 Permission denied 或者配置多个SSH Key跳第6步) git工具 下载地址:https://git-scm.com ...
- mac使用ssh出现permission denied(publickey)
看出错信息是权限太开放的问题,google了一下,修改权限,不只是需要修改 .pem 文件的权限,还需要修改.ssh目录和用户目录 chmod go-w ~/ chmod ~/.ssh chmod ~ ...
- ssh 出错 Permission denied (publickey,password).
将客户端的~/.ssh/know_hosts 文件删掉试试 ssh debug信息 ssh -vvv xxx@192.168.1.111
- SSH Key连接github提示Permission denied (publickey).错误
root@debian64:/home/xiaoliuzi/.ssh/key_backup# ssh -T git@github.com The authenticity of host 'githu ...
- ssh 协议执行repo sync 报错:Permission denied (publickey)
1.ssh key 已经添加ssh key到gerrit服务器,并且执行ssh协议的git clone可以正常克隆代码到本地,可见不是ssh key的问题. 2.manifest清单文件配置 最初在m ...
- 由于SSH配置文件的不匹配,导致的Permission denied (publickey)及其解决方法。
读者如要转载,请标明出处和作者名,谢谢.地址01:http://space.itpub.net/25851087地址02:http://www.cnblogs.com/zjrodger/作者名:zjr ...
- SSH方式登录github出现Permission denied (publickey)
今天在公司上传了代码,回到家pull,结果竟然出现了“Permission denied (publickey)“这种东西.第一反应是key不对,可是上次明明用key登录过,不可能不对啊,难道是文件被 ...
- ssh分发秘钥时出现错误“Permission denied (publickey,gssapi-keyex,gssapi-with-mic)”
因为公司的服务器连接是通过xshell公钥和密码连接的,今天在ssh分发秘钥的时候出现了,下面的错误: [root@iZ2ze97cumk8opqm28h8Z .ssh]# ssh-copy-id - ...
随机推荐
- 抓包工具__Windows
我常使用的: 1. SoftPerfect Network Protocol Analyzer 2. fiddler . fiddler2 3.
- iOS企业版打包(转载)
转自 http://www.cnblogs.com/shenlaiyaoshi/p/5472474.html 神来钥匙-陈诗友 iOS 企业版 打包 使用 iOS 企业版的证书发布应用可以跳过 A ...
- [转载] Go语言并发之美
原文: http://qing.blog.sina.com.cn/2294942122/88ca09aa33002ele.html 简介 多核处理器越来越普及,那有没有一种简单的办 ...
- poj1556The Doors
链接 枚举两点 若不和任何线段相交 建边为dis(i,j) floyd求最短路 #include <iostream> #include<cstdio> #include< ...
- linux环境变量LD_LIBRARY_PATH
LIBRARY_PATH和LD_LIBRARY_PATH是Linux下的两个环境变量,二者的含义和作用分别如下: LIBRARY_PATH环境变量用于在程序编译期间查找动态链接库时指定查找共享库的路径 ...
- overflow:auto/hidden的应用
一.自适应两栏布局 <!DOCTYPE html><html lang="zh-CN"><head> <meta charset=&quo ...
- Linux下利用rsync实现多服务器文件同步
windows做为文件服务器,使用rsync的windows服务版本,然后配置好就可以了.需要的朋友可以参考下. windows做为文件服务器,使用rsync的windows服务版本:cwRsyncS ...
- Google Chrome input 设置 line-height 后光标变得和input一样高
Google Chrome input的height和line-height设置为相同的比默认高度高的值时,当input控件获得焦点并且没有输入内容时,input中的光标会占满整个input控件(如果 ...
- Hbase之进行批处理操作
import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.hbase.HBaseConfiguration; impo ...
- C++ Primer 第三章 标准库类型vector+迭代器iterator 运算
1.vector: 标准库类型vector表示对象的集合,其中所有对象的类型都相同,集合中的每个对象都有一个与之对应的索引,索引用于访问对象.因为vector“容纳着”其他对象,所以它也常被称作容器( ...