2013-11-14 23:11:16 -07:00
|
|
|
#!/usr/bin/perl -w
|
2015-01-18 12:36:49 -07:00
|
|
|
=for commnet
|
|
|
|
|
|
|
|
Part of BBHN Mesh -- Used for creating Amateur Radio friendly mesh networks
|
|
|
|
Copyright (C) 2015 Conrad Lara
|
|
|
|
See Contributors file for additional contributors
|
|
|
|
|
|
|
|
Copyright (c) 2013 David Rivenburg et al. BroadBand-HamNet
|
|
|
|
|
|
|
|
This program is free software: you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
|
|
|
the Free Software Foundation version 3 of the License.
|
|
|
|
|
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
|
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
|
|
|
=cut
|
2013-11-14 23:11:16 -07:00
|
|
|
|
|
|
|
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";
|