Files
webmin/changepass.pl
Ilia Ross 7e41f339a3
Some checks failed
Tests / prove (push) Has been cancelled
Package and upload artifacts / build (push) Has been cancelled
Close inactive / close-inactive (push) Has been cancelled
Fix password reset handling for Unix-backed Webmin users
ⓘ Warn when a Webmin user matches a Unix account and allow choosing Unix authentication or a separate Webmin-only password. Preserve explicit and legacy password behavior with regression coverage.

https://forum.virtualmin.com/t/resetting-root-admin-password/137615/4
2026-07-23 17:25:39 +02:00

31 lines
802 B
Perl
Executable File

#!/usr/local/bin/perl
# changepass.pl
# Script for the user to change their webmin password
# Get Webmin directory
my $cwd = $0;
$cwd =~ s/(.*)\/.*/$1/;
# Check command line arguments
usage() if (@ARGV != 3);
my ($config, $user, $pass) = @ARGV;
exec "$cwd/bin/webmin", "passwd", "--webmin-only",
"--config", $config, "--user", $user, "--pass", $pass;
print STDERR "Error: Failed to execute Webmin CLI command: $!\n";
exit 1;
sub usage
{
print STDERR <<EOF;
usage: changepass.pl <config-dir> <login> <password>
This program allows you to change the password of a user in the Webmin
password file. For example, to change the password of the admin user
to foo, you would run:
- changepass.pl /etc/webmin admin foo
This assumes that /etc/webmin is the Webmin configuration directory.
EOF
exit 1;
}