Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,19 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [2.0.2] - 2026-07-18

### Fixed
- `setPassword` now uses `chpasswd` for reliable non-interactive password updates.
- `validateUsername` now accepts Linux login names up to 32 characters long.
- `addSSHtoUser` no longer appends duplicate keys to `authorized_keys`.
- `removeUser` and `addUserToGroup` now use `spawnWrapper` for consistent error
handling and timeout support.
- Direct `require('linux-sys-user/lib/promise')` now enforces the Linux platform
guard instead of bypassing it.
- Documentation and GitHub Pages navigation updated to reflect the current API,
including `chpasswd` and the `addUser` string shortcut.

## [2.0.0] - 2026-07-16

### Added
Expand Down
11 changes: 10 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,9 @@ console.log(user);

* callback function(err, userInfo)

A string may be passed instead of an object as a shortcut for
`{ username: string, create_home: true }`.

* linuxUser.getExpiration(username, callback)

Gets expiration information about a user, returns an Object:
Expand Down Expand Up @@ -348,7 +351,10 @@ console.log(user);
* username String
* password String
* callback function(err)


Uses `chpasswd` to set the password non-interactively. The system must
have `chpasswd` available (usually provided by `shadow-utils`).

* linuxUser.addGroup(groupname, callback)
* groupname String
* callback function(err, groupInfo)
Expand Down Expand Up @@ -386,6 +392,9 @@ console.log(user);
* key String
* callback function(err, true)

The key is appended to the user's `~/.ssh/authorized_keys` only if it is
not already present.


### License

Expand Down
9 changes: 5 additions & 4 deletions docs/api.html
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@ <h1>API Reference</h1>
<li><a href="api.html" class="active">API Reference</a></li>
<li><a href="examples.html">Examples</a></li>
<li><a href="getting-started.html">Getting Started</a></li>
<li><a href="installation.html">Installation</a></li>
</ul>
</div>
</nav>
Expand Down Expand Up @@ -182,7 +183,7 @@ <h4>addUser(args, callback)</h4>

<div class="param">
<strong>Parameters:</strong><br>
<code>args</code> - Object or String<br>
<code>args</code> - Object or String. When a string is passed it is treated as <code>{ username: string, create_home: true }</code>.<br>
&nbsp;&nbsp;• <code>username</code> (String) - User name of the user to be created<br>
&nbsp;&nbsp;• <code>shell</code> (String|null) - Path to login shell, null uses /usr/sbin/nologin<br>
&nbsp;&nbsp;• <code>create_home</code> (Boolean) - Create home directory<br>
Expand Down Expand Up @@ -346,7 +347,7 @@ <h3>🔐 Password Management</h3>

<div class="method">
<h4>setPassword(username, password, callback)</h4>
<p>Sets or changes a user's password.</p>
<p>Sets or changes a user's password using <code>chpasswd</code>.</p>
<div class="param">
<strong>Parameters:</strong><br>
<code>username</code> (String) - Username to set password for<br>
Expand Down Expand Up @@ -380,7 +381,7 @@ <h4>verifySSHKey(key, callback)</h4>

<div class="method">
<h4>addSSHtoUser(user, key, callback)</h4>
<p>Adds an SSH key to a user's authorized_keys file.</p>
<p>Adds an SSH key to a user's authorized_keys file. If the key already exists, the call succeeds without creating a duplicate.</p>
<div class="param">
<strong>Parameters:</strong><br>
<code>user</code> (String) - Username<br>
Expand Down Expand Up @@ -509,7 +510,7 @@ <h4>.promise(promisifyFunction)</h4>

<footer style="background: #2c3e50; color: white; text-align: center; padding: 2rem 0; margin-top: 3rem;">
<div class="container">
<p>&copy; 2024 linux-sys-user. MIT License. Built with ❤️ for the Node.js community.</p>
<p>&copy; 2026 linux-sys-user. MIT License. Built with ❤️ for the Node.js community.</p>
</div>
</footer>
</body>
Expand Down
3 changes: 2 additions & 1 deletion docs/examples.html
Original file line number Diff line number Diff line change
Expand Up @@ -207,6 +207,7 @@ <h1>linux-sys-user</h1>
<li><a href="index.html">Home</a></li>
<li><a href="api.html">API Reference</a></li>
<li><a href="examples.html" class="active">Examples</a></li>
<li><a href="getting-started.html">Getting Started</a></li>
<li><a href="installation.html">Installation</a></li>
<li><a href="https://github.com/wmantly/linux-user" target="_blank">GitHub</a></li>
</ul>
Expand Down Expand Up @@ -488,7 +489,7 @@ <h3>SSH Key Management</h3>
</div>

<div class="note">
<strong>Note:</strong> The addSSHtoUser method automatically creates the .ssh directory with proper permissions (700) and sets the authorized_keys file permissions to 600.
<strong>Note:</strong> The addSSHtoUser method automatically creates the .ssh directory with proper permissions (700) and sets the authorized_keys file permissions to 600. The key is only appended if it is not already present, so calling it multiple times with the same key will not create duplicates.
</div>
</div>

Expand Down
3 changes: 2 additions & 1 deletion docs/getting-started.html
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,7 @@ <h1>Getting Started</h1>
<li><a href="api.html">API Reference</a></li>
<li><a href="examples.html">Examples</a></li>
<li><a href="getting-started.html" class="active">Getting Started</a></li>
<li><a href="installation.html">Installation</a></li>
</ul>
</div>
</nav>
Expand Down Expand Up @@ -331,7 +332,7 @@ <h4>✅ Next Steps</h4>

<footer style="background: #2c3e50; color: white; text-align: center; padding: 2rem 0; margin-top: 3rem;">
<div class="container">
<p>&copy; 2024 linux-sys-user. MIT License. Built with ❤️ for the Node.js community.</p>
<p>&copy; 2026 linux-sys-user. MIT License. Built with ❤️ for the Node.js community.</p>
</div>
</footer>
</body>
Expand Down
3 changes: 2 additions & 1 deletion docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ <h1>linux-sys-user</h1>
<li><a href="api.html">API Reference</a></li>
<li><a href="examples.html">Examples</a></li>
<li><a href="getting-started.html">Getting Started</a></li>
<li><a href="installation.html">Installation</a></li>
</ul>
</div>
</nav>
Expand Down Expand Up @@ -243,7 +244,7 @@ <h3>Installation</h3>

<footer>
<div class="container">
<p>&copy; 2024 linux-sys-user. MIT License. Built with ❤️ for the Node.js community.</p>
<p>&copy; 2026 linux-sys-user. MIT License. Built with ❤️ for the Node.js community.</p>
</div>
</footer>
</body>
Expand Down
5 changes: 3 additions & 2 deletions docs/installation.html
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,7 @@ <h1>linux-sys-user</h1>
<li><a href="index.html">Home</a></li>
<li><a href="api.html">API Reference</a></li>
<li><a href="examples.html">Examples</a></li>
<li><a href="getting-started.html">Getting Started</a></li>
<li><a href="installation.html" class="active">Installation</a></li>
<li><a href="https://github.com/wmantly/linux-user" target="_blank">GitHub</a></li>
</ul>
Expand All @@ -244,7 +245,7 @@ <h3>⚠️ Important Prerequisites</h3>
<li><strong>Operating System:</strong> Linux (any distribution)</li>
<li><strong>Node.js:</strong> Version 6.0.0 or higher</li>
<li><strong>Privileges:</strong> Root access for most operations</li>
<li><strong>System Commands:</strong> useradd, userdel, groupadd, groupdel, usermod, passwd, chage, ssh-keygen</li>
<li><strong>System Commands:</strong> useradd, userdel, groupadd, groupdel, usermod, passwd, chpasswd, chage, ssh-keygen</li>
</ul>
</div>

Expand All @@ -256,7 +257,7 @@ <h3>⚠️ Important Prerequisites</h3>
whoami

# Verify required commands are available
which useradd userdel groupadd groupdel usermod passwd chage ssh-keygen</pre>
which useradd userdel groupadd groupdel usermod passwd chpasswd chage ssh-keygen</pre>
</div>
</div>

Expand Down
Loading
Loading