• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer navigation

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • Solaris
    • Oracle Linux
    • VCS
  • Interview Questions
  • Database
    • oracle
    • oracle 12c
    • ASM
    • mysql
    • MariaDB
  • DevOps
    • Docker
    • Shell Scripting
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

How to Verify the Syntax of the file /etc/ssh/sshd_config

by admin

If you have done any changes to the ssh configuration file, we will have to either reload or restart the sshd service. But if you have any syntax error in the file, the ssh service will not start and you might lose access to the server.

To avoid these issues, there is an option in sshd command to verify the syntax of the configruation file /etc/ssh/sshd_config. After making your changes, run this command:

$ sudo sshd -t

If there are no syntax errors, it exits silently. If it find mistakes, it tells you:

$ sudo sshd -t
/etc/ssh/sshd_config: line 9: Bad configuration option: Porotocol
/etc/ssh/sshd_config: terminating, 1 bad configuration options

While the SSH daemon is running, you can correct your mistakes before issuing a reload or restart command. The -t switch stands for test. It does not affect the SSH daemon, it only checks /etc/ssh/sshd_config for syntax errors, so you can use it anytime.

Once you have verified the syntax, you can restart or reload the ssh service. For example:

# systemctl restart sshd

Filed Under: Linux

Some more articles you might also be interested in …

  1. blkid Command Examples in Linux
  2. s2i: command not found
  3. blight Command Examples in Linux
  4. lnav: command not found
  5. smem: command not found
  6. host Command Examples in Linux
  7. How to Count lines in a file in UNIX/Linux
  8. How to add header and trailer line to a file in Linux
  9. UNIX / Linux : How crontab validates the access based on the cron.allow and cron.deny files
  10. How to merge 2 volume groups (VGs) into one using vgmerge in LVM

You May Also Like

Primary Sidebar

Recent Posts

  • aws ec2: CLI for AWS EC2 (Command Examples)
  • aws cur – Create, query, and delete AWS usage report definitions (Command Examples)
  • aws configure – Manage configuration for the AWS CLI (Command Examples)
  • aws cognito-idp: Manage Amazon Cognito user pool and its users and groups using the CLI

© 2023 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright