mirror of https://github.com/aredn/aredn.git
24 lines
478 B
Plaintext
24 lines
478 B
Plaintext
|
#!/usr/bin/perl -w
|
||
|
|
||
|
unless(defined ($pw = shift))
|
||
|
{
|
||
|
print STDERR "\nusage: setpasswd <password>\n";
|
||
|
print STDERR "this sets both the system and website paswords\n\n";
|
||
|
exit 1;
|
||
|
}
|
||
|
|
||
|
$pw2 = $pw;
|
||
|
$pw2 =~ s/'/'\\''/g;
|
||
|
system "{ echo '$pw2'; sleep 1; echo '$pw2'; } | passwd > /dev/null\n";
|
||
|
|
||
|
@web = `cat /etc/httpd.conf`;
|
||
|
open(FILE, ">/etc/httpd.conf") or die;
|
||
|
foreach(@web)
|
||
|
{
|
||
|
s/^(.*:root:)(.*)$/$1$pw/;
|
||
|
print FILE $_;
|
||
|
}
|
||
|
close(FILE);
|
||
|
|
||
|
print STDERR "passwords changed.\n";
|