Files
linuxsetup/setup.ssh
T
Michael WesemannandClaude Opus 5 96c5c2e65d setup.ssh: keep the newline when commenting out AcceptEnv
The $ in /(^\s*AcceptEnv.*$)/ matches before the newline, so $1 did not
contain it and the following line was appended to the comment - which
commented out the Subsystem sftp line on a stock Debian sshd_config.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
2026-08-14 10:55:10 +02:00

25 lines
351 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\n";
} else {
$out.=$_;
}
}
close(IN);
open(OUT,"> $SSHCONF");
print OUT $out;
close(OUT);
system("service ssh restart");