Manage public ssh keys in ~/.ssh/authorized_keys file.
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');
});
Return a new ssh manager instance.
List username
's public keys in ~username/.ssh/authorized_keys
.
Add a key to username
's public keys in ~username/.ssh/authorized_keys
.
Delete the key at index index
from username
's public keys in ~username/.ssh/authorized_keys
.
Delete all username
's public keys in ~username/.ssh/authorized_keys
.
With npm do:
npm install ssh-key-manager
Use browserify to require('ssh-key-manager')
.
MIT