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.
sshd_configfile using your favorite text editor.
$ 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.
-f option to test alternate configuration file.
$ sudo sshd -t -f /etc/ssh/sshd_config_test
sshd_configfile for errors and continue testing.
$ sudo sshd -t $
SSHdservice for the changes to take effect.
$ sudo systemctl restart sshd
Support us on Patreon if this guide has helped you. Thanks!!!
Comment anonymously. Login not required.