25 lines
349 B
Perl
Executable File
25 lines
349 B
Perl
Executable File
#!/usr/bin/perl
|
|
|
|
$SSHCONF='/etc/ssh/sshd_config';
|
|
|
|
$out="";
|
|
open(IN,$SSHCONF);
|
|
while(<IN>) {
|
|
|
|
if (/^\s*\#*\s*PermitRootLogin/) {
|
|
$out.="PermitRootLogin yes\n" ;
|
|
} elsif (/(^\s*AcceptEnv.*$)/) {
|
|
$out.="#$1";
|
|
} else {
|
|
$out.=$_;
|
|
}
|
|
}
|
|
close(IN);
|
|
|
|
open(OUT,"> $SSHCONF");
|
|
print OUT $out;
|
|
close(OUT);
|
|
|
|
system("service ssh restart");
|
|
|