%PDF-1.5 %���� ºaâÚÎΞ-ÌE1ÍØÄ÷{òò2ÿ ÛÖ^ÔÀá TÎ{¦?§®¥kuµùÕ5sLOšuY
Server IP : 49.231.201.246 / Your IP : 216.73.216.248 Web Server : Apache/2.4.18 (Ubuntu) System : Linux 246 4.4.0-210-generic #242-Ubuntu SMP Fri Apr 16 09:57:56 UTC 2021 x86_64 User : root ( 0) PHP Version : 7.0.33-0ubuntu0.16.04.16 Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority, MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /usr/share/webmin/cluster-passwd/ |
Upload File : |
#!/usr/bin/perl # change-passwd.pl # Changes a user's password on all cluster servers. Also changes # the password in other modules. $no_acl_check++; $ENV{'WEBMIN_CONFIG'} ||= "/etc/webmin"; $ENV{'WEBMIN_VAR'} ||= "/var/webmin"; if ($0 =~ /^(.*\/)[^\/]+$/) { chdir($1); } chop($pwd = `pwd`); $0 = "$pwd/change-passwd.pl"; do './cluster-passwd-lib.pl'; if ($ARGV[0] eq "--old" || $ARGV[0] eq "-old") { $askold = 1; shift(@ARGV); } @ARGV == 1 || &errordie("usage: change-passwd.pl [-old] <username>"); if (&foreign_installed("cluster-useradmin") != 1) { &errordie("Cluster Users and Groups module is not available"); } # Find the user @hosts = &cluster_useradmin::list_useradmin_hosts(); @ulist = &get_all_users(\@hosts); ($user) = grep { $_->{'user'} eq $ARGV[0] } @ulist; $user || &errordie("User $ARGV[0] does not exist"); $| = 1; if ($askold) { # Ask for the old password print "(current) UNIX password: "; $old = <STDIN>; $old =~ s/\r|\n//g; &unix_crypt($old, $user->{'pass'}) eq $user->{'pass'} || &errordie("Old password is incorrect"); } # Ask for password print "New password: "; $pass = <STDIN>; $pass =~ s/\r|\n//g; print "Retype new password: "; $again = <STDIN>; $again =~ s/\r|\n//g; $pass eq $again || &errordie("Passwords don't match"); # Check password sanity $err = &useradmin::check_password_restrictions($pass, $ARGV[0], $user); &errordie($err) if ($err); # Do it on all servers &modify_on_hosts(\@hosts, $user->{'user'}, $pass, 1, \&print_func); # All done exit(0); sub errordie { print STDERR @_,"\n"; exit(1); } # print_func(mode, message) sub print_func { if ($_[0] == -1) { print "$_[1]\n\n"; $indent = " "; } elsif ($_[0] == -2) { print "$indent$_[1]\n"; } elsif ($_[0] == -3) { print "$indent$_[1]\n\n"; } elsif ($_[0] == -4) { $indent = ""; print "\n"; } elsif ($_[0] > 0) { print "$indent$_[1]\n\n"; $indent = ""; } }