- or download this
my $sshport;
while ( $sshport !~ /^[1-9]\d+$/ || $sshport > 65535 ) {
print " Please Enter valid ssh port number:\n";
chomp( $sshport = <STDIN> );
}
- or download this
while (<SSHD_CONFIG>){
s/^Port.+/Port $sshport/i;
s/^#Port\s.+/Port $sshport/i;
print SSHD_CONFIG_NEW $_;
}
- or download this
rename('sshd_config','sshd_config.old')
or die "Can't rename sshd_config: $!";
rename('sshd_config.new','sshd_config')
or die "Can't rename sshd_config.new: $!";