SSH 密钥不适用于 meteor-up 和 Digital Ocean

SSH key not working with meteor-up and Digital Ocean

我正在使用 meteor-up 和 Digital Ocean。如果我使用用户名和密码进行身份验证,它就可以正常工作。然而,当我尝试使用我的 SSH 密钥时,它给出了一个错误,mup setup returns All configured authentication methods failed

这是我的 mup.js 文件(为了安全我已经更改了我的 IP、密码和用户名):

module.exports = {
    servers: {
        one: {
            // TODO: set host address, username, and authentication method
            host: '139.49.141.100',
            username: 'root',
            pem: '/Users/MYUSERNAME/.ssh/id_rsa',
            // pem: '~/.ssh/id_rsa',
            // password: 'MY-PASSWORD',
            // or neither for authenticate from ssh-agent
        },
    },

    app: {
        // TODO: change app name and path
        name: 'nomad',
        path: '../',

        servers: {
            one: {},
        },

        buildOptions: {
            serverOnly: true,
        },

        env: {
            // TODO: Change to your app's url
            // If you are using ssl, it needs to start with https://
            ROOT_URL: 'http://139.49.141.100',
            MONGO_URL: 'mongodb://localhost/meteor',
        },

        // ssl: { // (optional)
        //   // Enables let's encrypt (optional)
        //   autogenerate: {
        //     email: 'email.address@domain.com',
        //     // comma separated list of domains
        //     domains: 'website.com,www.website.com'
        //   }
        // },

        docker: {
            // change to 'abernix/meteord:base' if your app is using Meteor 1.4 - 1.5
            image: 'abernix/meteord:node-8.4.0-base',
        },

        // Show progress bar while uploading bundle to server
        // You might need to disable it on CI servers
        enableUploadProgressBar: true,
    },

    mongo: {
        version: '3.4.1',
        servers: {
            one: {},
        },
    },
};

我在 https://cloud.digitalocean.com/settings/security

添加了 SSH 密钥的 public 部分

我也试过生成一个新的 SSH 密钥,但我得到了相同的结果。

在我的终端中,如果我转到 /Users/MYUSERNAME/.ssh/~/.ssh/,我可以看到 id_rsa、id_rsa.pub、id_rsa_2 和 id_rsa_2.pub 都在那里。

将 SSH 密钥添加到您的帐户是不够的,您还需要将其添加到存储桶中。

我按照此处的说明操作: https://www.digitalocean.com/community/questions/add-ssh-key-after-creating-a-droplet

运行 来自我本地机器的这条命令移到了键上:

cat ~/.ssh/id_rsa.pub | ssh root@your.ip.address "cat >> ~/.ssh/authorized_keys"

感谢 Oliver 解决了这个问题(请参阅我原来问题下的评论)