Linux Administration Cookbook
上QQ阅读APP看书,第一时间看更新

How it works...

All we've done here is duplicate a few files and made some sensible changes to ensure that the two processes don't interact with each other very much.

First, we created the following file:

/etc/ssh/sshd_config_2020

We then ran a couple of sed commands to change some values. Specifically, we modified the port the server would listen on, and the process ID file it would use (the PID modification is frequently overlooked).

Next, we copied the systemd unit file that comes with the OpenSSH server package on CentOS, tweaking it slightly by changing the description and pointing it to a different environment file.

We put the resulting unit file ( sshd_2020.service) in a different location to the original to differentiate it from a supplied default.

We copied the environment file and made a modification to pass a new option to the SSH daemon when it's started. This new option was a different configuration file (the one we started off making):

OPTIONS="-u0 -f /etc/ssh/sshd_config_2020"

We then updated our SELinux policy to make it aware of the new server's intentions, reloaded systemd's running configuration, and both enabled and started our server.

Your milage may vary in terms of the standard location for configuration and environment files. This can change between major distro releases, and some settings frequently differ between different distributions.