ssh-key-manager
manage ssh keys in ~user/.ssh/authorized_keys
Last updated 7 years ago by pkrumins .
MIT · Repository · Original npm · Tarball · package.json
$ cnpm install ssh-key-manager 
SYNC missed versions from official npm registry.

SSH Key Manager

Manage public ssh keys in ~/.ssh/authorized_keys file.

Example

Adding a new key:

var sshManager = require('ssh-key-manager');
sshManager.addKey('pkrumins', 'asdasdasd21312123 (key)', function (err) {
    if (err) {
        console.log(err);
        return;
    }
});

Listing keys:

var sshManager = require('ssh-key-manager');
sshManager.listKeys('pkrumins', function (err, keys) {
    if (err) {
        console.log(err);
        return;
    }
    var i = 0;
    keys.forEach(function (key) {
        console.log(i, key);
        i++;
    });
});

Deleting a key by index:

var sshManager = require('ssh-key-manager');
sshManager.deleteKey('pkrumins', 0, function (err) {
    if (err) {
        console.log(err);
        return;
    }
    console.log('Key 0 deleted ok');
});

Deleting all keys:

var sshManager = require('ssh-key-manager');
sshManager.deleteAllKeys('pkrumins', function (err) {
    if (err) {
        console.log(err);
        return;
    }
    console.log('All keys deleted ok');
});

Methods

var sshManager = sshManager()

Return a new ssh manager instance.

sshManager.listKeys(username, cb)

List username's public keys in ~username/.ssh/authorized_keys.

sshManager.addKey(username, key, cb)

Add a key to username's public keys in ~username/.ssh/authorized_keys.

sshManager.deleteKey(username, index, cb)

Delete the key at index index from username's public keys in ~username/.ssh/authorized_keys.

sshManager.deleteAllKeys(username, cb)

Delete all username's public keys in ~username/.ssh/authorized_keys.

Install

With npm do:

npm install ssh-key-manager

Use browserify to require('ssh-key-manager').

License

MIT

Current Tags

  • 0.0.2                                ...           latest (7 years ago)

2 Versions

  • 0.0.2                                ...           7 years ago
  • 0.0.1                                ...           8 years ago
Maintainers (1)
Downloads
Today 0
This Week 0
This Month 1
Last Day 0
Last Week 1
Last Month 2
Dependencies (3)
Dev Dependencies (0)
None
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |