Git SSH 设置权限被拒绝(公钥)

标签 git ssh github ssh-keys

我使用的是 Ubuntu 8.04 的 VWWare 镜像,在通过 SSH 设置 git 访问时遇到问题

我得到以下输出

debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Offering public key: 
debug1: Authentications that can continue: publickey
debug1: Offering public key: 
debug1: Authentications that can continue: publickey
debug1: Offering public key: 
debug1: Authentications that can continue: publickey
debug1: Offering public key: 
debug1: Authentications that can continue: publickey
debug1: Trying private key: /home/jars/.ssh/identity
debug1: PEM_read_PrivateKey failed
debug1: read PEM private key done: type <unknown>
Enter passphrase for key '/home/jars/.ssh/identity': 
debug1: read PEM private key done: type RSA
debug1: Authentications that can continue: publickey
debug1: No more authentication methods to try.
Permission denied (publickey).

我已经用 ssh-keygen -t rsa 生成了 key

并将它们重命名为 identity(私有(private))和 ida_rsa(公共(public)),因为最初它们无法被 ssh 找到。

我还创建了一个配置文件 as depicted here ...

http://help.github.com/troubleshooting-ssh/

没有任何改变。

我是否遗漏了什么或者在 VMWare 中使用 SSH 通常有什么问题?

问候

最佳答案

检查您对本地和远程端的 .ssh 目录的权限:

drwx------ 3 xxx xxx 216 10-04 12:30 .ssh/
-rw------- 1 xxx xxx  745 06-19 12:37 authorized_keys
-rw------- 1 xxx xxx  783 05-08 22:15 config
-rw------- 1 xxx xxx 3.3K 2009-02-21  id_rsa
-rw------- 1 xxx xxx  745 2009-03-06  id_rsa.pub
-rw-r--r-- 1 xxx xxx  53K 09-27 15:51 known_hosts

如果这不起作用,请在 Debug模式下从命令行运行 SSH 服务器。它可能会为您提供有关拒绝登录的更多信息。

sudo /usr/sbin/sshd -Dd

关于Git SSH 设置权限被拒绝(公钥),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3858928/

相关文章:

git:无法克隆私有(private)存储库,错误:找不到存储库

git - 将仓库克隆到现有目录(已安装依赖项)

python - setuptools-scm:当前版本而不是下一版本

Git - 到处忽略node_modules文件夹

linux - 使用 ProxyTunnel "Socket read error: [104] Connection reset by peer"通过 HTTP 进行 SSH

具有多个命令的 Linux SSH

git - 在 pull 请求 merge 父分支后删除父分支是否安全?

git - 尝试克隆git-项目名称不正确吗?

Git:在所有子模块上递归切换分支( checkout )

python - 使用子进程从 python 执行时,ssh 不被识别为命令?