mirror of
https://github.com/webmin/webmin.git
synced 2026-08-01 22:10:34 +01:00
ⓘ 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
31 lines
802 B
Perl
Executable File
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;
|
|
}
|