About linux-sys-user
Easily manage Linux users and groups with a simple Node.js API. Full promise and async/await support out of the box, ES5 compatibility, and zero dependencies!
Key Features
🔧 User Management
Create, modify, and delete Linux users with comprehensive options including home directory creation, shell selection, and expiration settings.
👥 Group Management
Manage Linux groups, add users to groups, and handle group permissions with simple API calls.
🔑 SSH Key Management
Add and verify SSH keys for users with automatic directory structure creation and proper permissions.
⏰ Expiration Control
Set and manage user account expiration, password policies, and inactivity settings using the chage command.
📦 Promise Support
Built-in promise support with util.promisify, making it easy to use with async/await syntax.
🎯 Zero Dependencies
Pure Node.js implementation with no external runtime dependencies, ensuring minimal footprint and maximum compatibility.
Quick Start
const linuxUser = require('linux-sys-user');
// Add a new user
linuxUser.addUser({
username: "john",
create_home: true,
shell: "/bin/bash"
}, function(err, user) {
if (err) {
console.error('Error:', err);
} else {
console.log('User created:', user);
}
});
// Using promises
const linuxUserPromise = require('linux-sys-user').promise();
async function createUser() {
try {
const user = await linuxUserPromise.addUser({
username: "john",
create_home: true,
shell: "/bin/bash"
});
console.log('User created:', user);
} catch (err) {
console.error('Error:', err);
}
}
Installation
npm install linux-sys-user --save