Inspect SSH config with cat /etc/ssh/sshd_config
In this final step, you will examine the main configuration file for the SSH server. This file contains settings that control how the SSH service behaves, such as which port it listens on, which users are allowed to connect, and security options.
The configuration file for the SSH daemon (sshd
) is typically located at /etc/ssh/sshd_config
. The /etc
directory is where system configuration files are stored.
To view the contents of this file, you can use the cat
command. cat
is a simple command that reads files sequentially and prints them to the standard output (your terminal).
Type the following command into your terminal and press Enter:
cat /etc/ssh/sshd_config
You will see the entire content of the sshd_config
file printed in your terminal. The output will contain many lines, some starting with #
(which are comments and are ignored by the system) and others defining configuration options.
Look for lines that are not commented out (do not start with #
). Some important directives you might see include:
Port 22
: This specifies the port the SSH server listens on. By default, it's 22.
ListenAddress 0.0.0.0
: Specifies the IPv4 address the server listens on.
ListenAddress ::
: Specifies the IPv6 address the server listens on.
PermitRootLogin prohibit-password
: Controls whether the root user can log in directly via SSH.
PasswordAuthentication yes
: Controls whether password authentication is allowed.
## This is the sshd server system configuration file.
## See sshd_config(5) for more information.
## The systemd service file for sshd uses EnvironmentFile to load
## the SSHD_CONFIG environment variable, setting this to /etc/ssh/sshd_config.
## ...
Port 22
#AddressFamily any
#ListenAddress 0.0.0.0
#ListenAddress ::
#HostKey /etc/ssh/ssh_host_rsa_key
#HostKey /etc/ssh/ssh_host_dsa_key
#HostKey /etc/ssh/ssh_host_ecdsa_key
#HostKey /etc/ssh/ssh_host_ed25519_key
## Ciphers and keying
#...
## Authentication:
LoginGraceTime 2m
PermitRootLogin prohibit-password
StrictModes yes
#MaxAuthTries 6
#MaxSessions 10
#PubkeyAuthentication yes
## Expect .ssh/authorized_keys2 to be disregarded by default in future.
#AuthorizedKeysFile .ssh/authorized_keys .ssh/authorized_keys2
#IgnoreRhosts yes
#RhostsRSAAuthentication no
#HostbasedAuthentication no
#...
PasswordAuthentication yes
#PermitEmptyPasswords no
ChallengeResponseAuthentication no
#...
Reading configuration files like this is a key skill for understanding and managing Linux services. While you won't modify the file in this lab, knowing where it is and how to view its contents is very useful.
You have now successfully checked the SSH service status, verified its listening port, and inspected its configuration file. You've gained valuable experience with fundamental Linux commands for service management and network inspection.
Click Continue to complete the lab and see your progress!