“Permission denied (publickey)” after moving /etc/ssh/sshd_config
Moving the SSH daemon’s config file is one of those quick‑fixes that turns into a full‑blown headache. The first thing I see in production is the classic “Permission denied (publickey)” on every login attempt. In practice, it’s almost always a permissions or path mis‑match.
1. Verify the new location
# Example: moving to /opt/sshd/sshd_config
sudo mkdir -p /opt/sshd
sudo mv /etc/ssh/sshd_config /opt/sshd/
The daemon still expects /etc/ssh/sshd_config unless you tell it otherwise. I usually edit the systemd unit with a drop‑in: