Smart Systems for Home

Plain how-to guides for smart home, security and home Wi-Fi

What Is an sshd? Linux SSH Server Explained

· 5 min read · Home Tech

In this article
  1. What Does sshd Actually Do?
  2. Where Does the Name Come From?
  3. How to Check if sshd Is Running
  4. Where Is the sshd Configuration File?
  5. Common Problems and How to Fix Them
  6. Security Best Practices for sshd
  7. sshd vs. ssh: What's the Difference?
  8. Frequently Asked Questions

Yes, sshd is the name of the SSH server daemon on Linux and other Unix-like systems. It is the background process that listens for incoming SSH connections, authenticates users, and gives them a secure encrypted shell or command execution. The name comes from SSH Daemon — "daemon" being the Unix term for a program that runs in the background. You will almost always see it written in lowercase as sshd, and it is a standard, official component of the OpenSSH suite, not slang or informal.

What Does sshd Actually Do?

When you connect to a server with ssh user@host, your client talks to the sshd process running on that host. The daemon handles the entire session:

  • Listens on TCP port 22 by default for incoming SSH requests.
  • Performs the cryptographic handshake (key exchange, host key verification).
  • Authenticates the user via password, public key, or other methods.
  • Starts a shell (like bash) or runs a single command on behalf of the user.
  • Keeps the session alive and encrypts all traffic between client and server.

Without sshd running, no one can SSH into that machine. It is the server-side counterpart to the ssh client program.

Where Does the Name Come From?

The term is a direct combination of SSH (Secure Shell) and the Unix convention of calling background services daemons. The original SSH protocol was created by Tatu Ylönen in 1995, and the OpenSSH implementation (which includes sshd) was later developed by the OpenBSD project. The name has stuck because it is short, descriptive, and follows the classic Unix naming pattern (like httpd for the Apache web server or crond for the cron scheduler).

It is a standard technical term, not informal. You will find it in official man pages, systemd service names, and configuration file paths. In casual conversation, admins often say "sshd" out loud as "S-S-H-D" or "ssh dee", but the written form is always lowercase.

How to Check if sshd Is Running

On most modern Linux distributions, sshd runs as a systemd service. To see its status, open a terminal and run:

systemctl status sshd

If you are on a system without systemd (older distributions or some containers), use:

ps aux | grep sshd

You should see a line with /usr/sbin/sshd if it is active. If not, you can start it with:

sudo systemctl start sshd

And enable it to start automatically at boot with:

sudo systemctl enable sshd

On some distributions the service is called ssh instead of sshd (for example, on Debian/Ubuntu). In that case, use systemctl status ssh. The exact name can vary, but the binary is still sshd.

Where Is the sshd Configuration File?

The main configuration file is almost always /etc/ssh/sshd_config. This is where you control how the daemon behaves. Common settings include:

  • Port 22 — change the listening port.
  • PermitRootLogin no — disable direct root logins (recommended).
  • PasswordAuthentication yes/no — enable or disable password logins.
  • PubkeyAuthentication yes — allow public key authentication.

After editing the file, you must restart the daemon for changes to take effect:

sudo systemctl restart sshd

Always test your SSH connection in a separate terminal before closing the current session, because a misconfiguration can lock you out.

Common Problems and How to Fix Them

If you cannot connect to a server, the issue is often with sshd. Here is a quick troubleshooting order:

  1. Check if the service is running: systemctl status sshd (or ssh).
  2. Check the firewall: Ensure port 22 (or your custom port) is open. On many systems, sudo ufw status shows the firewall rules.
  3. Look at the logs: sudo journalctl -u sshd or tail -f /var/log/auth.log (on Debian/Ubuntu) will show authentication attempts and errors.
  4. Verify the configuration: Run sudo sshd -t to test the config file for syntax errors.
  5. Restart the daemon: After any config change, restart it and try again.

If you still cannot connect, check that the client is using the correct port and that the host key is accepted. Sometimes the issue is on the client side, not the server.

Security Best Practices for sshd

Because sshd is exposed to the internet, it is a common target for attacks. Here are the most important things you can do:

  • Disable root login: Set PermitRootLogin no in sshd_config and use a regular user with sudo.
  • Use public key authentication: Disable password authentication (PasswordAuthentication no) once your keys are in place. This blocks brute-force password guessing.
  • Change the default port: Moving from 22 to a random high port reduces automated scans (though it is not real security, it cuts down noise).
  • Use a firewall: Restrict which IPs can reach port 22 if possible.
  • Keep OpenSSH updated: Always install security updates for your system.

Note that these are recommendations, not guarantees. Always follow your organization's security policies.

sshd vs. ssh: What's the Difference?

Many people confuse the two. The short answer:

  • ssh is the client program you run on your local machine to connect to a remote server.
  • sshd is the server daemon that runs on the remote machine and accepts those connections.

They are part of the same OpenSSH suite, but they are separate binaries. You install openssh-client on your laptop and openssh-server on the server. The server package provides sshd.

Frequently Asked Questions

Is sshd the same as SSH?

No. SSH is the protocol and the client command. sshd is the server daemon that implements the server side of the protocol. You use ssh to connect to a machine that runs sshd.

How do I restart sshd after changing the config?

Use sudo systemctl restart sshd (or sudo systemctl restart ssh on some distributions). Always test the config first with sudo sshd -t to avoid locking yourself out.

Why is sshd not running on my server?

It may not be installed. On Debian/Ubuntu, install it with sudo apt install openssh-server. On RHEL/Fedora, use sudo dnf install openssh-server. Then start and enable it with systemctl.

Can I run sshd on a non-standard port?

Yes. Change the Port line in sshd_config to any unused port (e.g., 2222) and restart. Then connect with ssh -p 2222 user@host. Make sure your firewall allows that port.

Is it safe to expose sshd to the internet?

It can be safe if you follow best practices: disable root login, use key-based authentication, keep the software updated, and consider a firewall. But no service is 100% risk-free, so limit exposure if possible.

What does "sshd: Connection closed by remote host" mean?

This usually means the SSH handshake failed or the server closed the connection. Common causes: wrong port, firewall blocking, or the server rejecting your authentication method. Check the server logs (journalctl -u sshd) for details.