Your SSH server need to be restarted for any changes to take effect. If you're editing your sshd_config file from an SSH connection, any misconfiguration would mean you yourself will be locked out from the server as the SSHd service fails to start and will not be able to further fix the configuration issue.
SSHd has a test mode where it will only check the validity of your SSH server configuration file and immediately exit. It will display errors if there are any, and you can continue to make changes until there are no more errors.
$ sudo vi /etc/ssh/sshd_config [sudo] password for user:
# Example of overriding settings on a per-user basis #Match User anoncvs # X11Forwarding no # AllowTcpForwarding no # PermitTTY no # ForceCommand cvs server PrintMotd not :wq
$ sudo sshd -t /etc/ssh/sshd_config line 124: unsupported option "not".
-t Test mode. Only check the validity of the configuration file and sanity of the keys. This is useful for updating sshd reliably as configuration options may change.
Use -f option to test alternate configuration file.
$ sudo sshd -t -f /etc/ssh/sshd_config_test
$ sudo sshd -t $
$ sudo systemctl restart sshd
Comment anonymously. Login not required.