【问题标题】:ssh giving me a permission denied!ssh 给我的权限被拒绝!
【发布时间】:2011-01-06 15:09:46
【问题描述】:

我不是这方面的专家,但我很确定我已经涵盖了这里的所有内容。

这是我写的:

$ ssh-keygen -t rsa -C "tekkub@gmail.com"
Generating public/private rsa key pair.
Enter file in which to save the key (/Users/tekkub/.ssh/id_rsa):
Enter passphrase (empty for no passphrase):
Enter same passphrase again:
Your identification has been saved in /Users/tekkub/.ssh/id_rsa.
Your public key has been saved in /Users/tekkub/.ssh/id_rsa.pub.
The key fingerprint is:
01:0f:f4:3b:ca:85:d6:17:a1:7d:f0:68:9d:f0:a2:db tekkub@gmail.com
The key's randomart image is:
+--[ RSA 2048]----+
|     .+   +      |
|       = o O .   |
|        = * *    |
|       o = +     |
|      o S .      |
|     o o =       |
|      o . E      |
|                 |
|                 |
+-----------------+

然后我pbcopy'd 信息到我的 github 帐户。保存了它。执行 ssh git@github.com 并按预期工作。

然后我设置我的配置文件..

主机总部 主机名 75.101.0.93 用户alorus 身份文件 ~/.ssh/id_rsa StrictHostKeyChecking no

然后我尝试了ssh hq

Permission Denied

我这样做了:

chmod 700 ~/.ssh
chmod 600 ~/.ssh/*

又试了。。没有。

试过这个:

ssh-keygen -t dsa -C "tekkub@gmail.com"

创建了一个新的 pub,新的密钥,但它失败了。

我运行了这个:

Gladys-MacBook-Pro:.ssh larrykain$ ssh -v hq
OpenSSH_5.2p1, OpenSSL 0.9.8l 5 Nov 2009
debug1: Reading configuration data /Users/larrykain/.ssh/config
debug1: Applying options for hq
debug1: Reading configuration data /etc/ssh_config
debug1: Connecting to 75.101.o.93 [75.101.o.93] port 22.
debug1: Connection established.
debug1: identity file /Users/larrykain/.ssh/id_rsa type 1
debug1: Remote protocol version 2.0, remote software version OpenSSH_5.1
debug1: match: OpenSSH_5.1 pat OpenSSH*
debug1: Enabling compatibility mode for protocol 2.0
debug1: Local version string SSH-2.0-OpenSSH_5.2
debug1: SSH2_MSG_KEXINIT sent
debug1: SSH2_MSG_KEXINIT received
debug1: kex: server->client aes256-ctr hmac-md5 none
debug1: kex: client->server aes256-ctr hmac-md5 none
debug1: SSH2_MSG_KEX_DH_GEX_REQUEST(1024<4096<8192) sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_GROUP
debug1: SSH2_MSG_KEX_DH_GEX_INIT sent
debug1: expecting SSH2_MSG_KEX_DH_GEX_REPLY
debug1: Host '75.101.0.93' is known and matches the RSA host key.
debug1: Found key in /Users/larrykain/.ssh/known_hosts:2
debug1: ssh_rsa_verify: signature correct
debug1: SSH2_MSG_NEWKEYS sent
debug1: expecting SSH2_MSG_NEWKEYS
debug1: SSH2_MSG_NEWKEYS received
debug1: SSH2_MSG_SERVICE_REQUEST sent
debug1: SSH2_MSG_SERVICE_ACCEPT received
debug1: Authentications that can continue: publickey
debug1: Next authentication method: publickey
debug1: Offering public key: /Users/larrykain/.ssh/id_rsa
debug1: Authentications that can continue: publickey
debug1: Offering public key: /Users/larrykain/.ssh/id_rsa
debug1: Authentications that can continue: publickey
debug1: No more authentication methods to try.
Permission denied (publickey).

有人知道怎么回事吗?

【问题讨论】:

    标签: ssh github


    【解决方案1】:

    您需要cat ~/.ssh/id_rsa.pub &gt;&gt; ~/.ssh/authorized_keys不知道在github上具体怎么做,但是key必须在authorized_keys列表中。

    糟糕,现在我看到你正试图回到你控制的盒子。没问题:)

    【讨论】:

    • 好点。我有我的主箱。是的,那行得通。这是我试图把它放在它不起作用的辅助盒子上。我尝试在不起作用的盒子上执行你的命令。
    • @Trip 只是为了完全清楚:你有 ssh 私钥 id_rsa,在你正在 sshing 来自的盒子上的 ~/.ssh 中。并且您在 ssh to 的盒子上的 ~/.ssh/authorized_keys 中拥有 ssh 公钥 id_rsa.pub 的内容。抱歉,我的回答应该更清楚
    • 迈克尔这太令人尴尬了,但我试图通过 ssh 进入服务器,但将我的 .pub 上传到 github,而不是服务器。我试图删除这个,但它说我有很多答案。所以我想让你相信你很棒。 :D~
    【解决方案2】:

    此时您是否可以访问服务器?检查 sshd 日志以了解它拒绝您的密钥的原因。

    【讨论】:

      【解决方案3】:

      试试ssh-copy-id -i $HOME/.ssh/{yourpublickey} username@ipmachine

      使用您的凭据帐户更改用户名和 ipmachine

      【讨论】:

        猜你喜欢
        • 2011-02-11
        • 2015-06-18
        • 2021-07-11
        • 2019-11-24
        • 2016-10-15
        • 2014-11-08
        • 2020-02-03
        • 2019-03-11
        • 1970-01-01
        相关资源
        最近更新 更多