Skip to content

(Solved) Error: Unable to parse private key while generating public key (expected sequence) #6

Description

@robsonfagundes

Hi there!

Folks I get the following error when I'm trying run my cmds with remote-exec.

Error: Unable to parse private key while generating public key (expected sequence)

Anyone know why?
Thankyou!

My code:

controller.mySync = function(req, res) {

    // remote-exec
    var connection_options = {
        port: 22,
        username: 'user',
        privateKey: require('fs').readFileSync('/home/host/.ssh/id_rsa'),
        passphrase: ''      
    }

    var hosts = [
        '192.168.1.1'
    ];

    var cmds = [
        'ls -l',
        'cat /etc/hosts'
    ];

    rexec(hosts, cmds, connection_options, function(err, stdout, stderr){
        if (err) {
            console.log(err);
            res.status(500).json(err);
        } else {
            console.log('Great Success!!');
            res.status(200).json(stdout);
        }
    });

};

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions