NAME
Langertha::Holmgang::Sim::Linux::Accounts - Accounts and sudo on a simulated Linux server — passwd, chage, deluser, userdel, visudo, sudo -l
VERSION
version 0.001
SYNOPSIS
# from the Linux simulator
my ( $out, $ok ) = Langertha::Holmgang::Sim::Linux::Accounts::passwd( $dev, [ '-l', 'mmeier' ] );
Langertha::Holmgang::Sim::Linux::Accounts::set_expire( $dev, $user_entry, '1' );
DESCRIPTION
Accounts of a Debian 12 device of type linux (cai-platform docs/entwurf-evals.md §3.3.1) and the sudo rules from /etc/sudoers with /etc/sudoers.d/.
users:
mmeier: { uid: 1004, groups: [ mmeier, sudo, docker ], shell: /bin/bash,
locked: false, # password locked (usermod -L, passwd -l)
expire: 20381, # expiry in days since 1970 (usermod -e, chage -E)
expired: true } # set by the simulator: expiry reached on the simulation day (2026-10-20)
Commands: passwd -l|-u|-S|-d user, chage -E date|-1|0 user, chage -l user, deluser user group (out of the group), deluser [--remove-home] user, userdel [-r] user (account gone, with -r also /home/user), getent shadow, visudo -c [-f file] (syntax, mode 0440 and owner root of every source; sudo does not read files in /etc/sudoers.d with a dot or ~ in the name), sudo -l [-U user] (the rules that apply to the user). A locked password does not stop a login with a key; an expired account or a nologin/false shell does ("login_denied" in Langertha::Holmgang::Sim::Linux::Sshd).
set_expire
my $err = set_expire( $dev, $user_entry, $value ); # date YYYY-MM-DD, days, '' or -1 = no expiry
passwd
my ( $out, $ok ) = passwd( $dev, \@argv );
passwd -l|-u|-S|-d|-e user; there is no interactive setting.
chage
my ( $out, $ok ) = chage( $dev, \@argv );
chage -E date|days|-1 user sets the expiry, chage -l user shows it.
remove_group
my ( $out, $ok ) = remove_group( $dev, $user, $group, $style ); # gpasswd | deluser
deluser
my ( $out, $ok ) = deluser( $dev, \@argv );
deluser user group takes the user out of the group; deluser [--remove-home] user deletes the account.
userdel
my ( $out, $ok ) = userdel( $dev, \@argv );
userdel [-r] user: account gone, with -r also /home/user and /var/mail/user.
shadow_line
A line as in /etc/shadow (hash made up, ! in front for a locked password).
visudo
my ( $out, $ok ) = visudo( $dev, \@argv );
visudo -c [-q] [-f file]: syntax, owner root and mode 0440/0400 of every source.
sudo_list
my ( $out, $ok ) = sudo_list( $dev, $user, $host );
sudo -l [-U user]: the rules of all sources that apply to the user (or one of their groups).
sudo_check
my $why = sudo_check( $dev, $user, $target, $path, $found, \@args, $non_interactive, $host );
May a user without root rights run sudo [-u target] command without a password? undef means yes (the last matching rule carries NOPASSWD); otherwise sudo's message — without a terminal sudo cannot read a password.
SUPPORT
Issues
Please report bugs and feature requests at https://github.com/Getty/langertha-holmgang/issues.
IRC
Join #langertha on irc.perl.org or message Getty directly.
CONTRIBUTING
Contributions are welcome! Please fork the repository and submit a pull request.
AUTHOR
Torsten Raudssus <torsten@raudssus.de>
COPYRIGHT AND LICENSE
This software is copyright (c) 2026 by Torsten Raudssus <torsten@raudssus.de> https://raudssus.de/.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.