- create a file
<username>
inside directory calledkeys
and add any number of keys there. A user can have multiple ssh keys. - Eg: create a file
keys/jake
and add any number of keys in the that file. All these keys will be treated as Jake's key
- Create a file called
servers.js
which should export an array of objects - Each object can have the following properties
host:
hostname or IP addreessname:
A name to indentify the server.port:
Port number ( Optional. default 22 )user:
ssh user ( Optional : default: devuser )
Eg
module.exports = [
{
name: 'app1Dev',
host: '8.8.8.8',
},
{
name: 'app1Staging',
host: '8.8.8.9',
},
];
- list currently loaded server names and usernames
npx ssh-access-manager -a
- list status of all servers.
npx ssh-access-manager -l
- grant access to username 'jake' on server called 'devserver'
npx ssh-access-manager -n devserver -g jake
- set access of server 'devserver' to user 'jake' only
npx ssh-access-manager -n devserver -s jake
- revoke access to username 'jake' on server called 'devserver'
npx ssh-access-manager -n devserver -r jake
- Dump curret Access-Control-List ( ACL ) for servers. ( Ie, simply dump output of
-l
command as json )
npx ssh-access-manager -l -j
- Update server access from
acl.js
file.
npx ssh-access-manager -U
We can create a acl.js file by simply dumping current state in all the servers.
npx ssh-access-manager -l -j >> acl.json
var server = new Server( [ '[email protected]', 1122 ] );
// list the usernames in the server
server.listAccess(); // -> Promise( Array<String> )
server.grantAccess( 'hari' ); // -> Promise( Array<String> )
server.revokeAccess( 'hari' ); // -> Promise( Array<String> )
server.setAccess( 'hari' ); // -> Promise( Array<String> )