#!/usr/bin/perl -w
=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 .
=cut
unless(defined ($pw = shift))
{
print STDERR "\nusage: setpasswd \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";