Centos8 SSH Configuration not picked up


I am trying to set up SSH on a fresh Centos 8 VM.

First I create a user and add to the wheel group since I don't want to operate with root.

adduser username && passwd username
usermod -aG wheel username
su username

Then I create a file /etc/ssh/ssh_config.d/custom.conf

LoginGraceTime 1m
PermitRootLogin no
PubkeyAuthentication yes
PasswordAuthentication no
PermitEmptyPasswords no
IgnoreRhosts yes
Protocol 2
AllowUsers username

I restart sshd with sudo systemctl restart sshd and even shut the server down and rebooted.

However, I still can login with password from root and username. What am I missing?

2 Replies

I don't have any experience with CentOS, and Ubuntu doesn't have the ssh_config.d directory, so this is just a guess.

SSH has 2 config files - one server sshd_config and one client ssh_config.

Your file is in /etc/ssh/ssh_config.d - is there a /etc/ssh/sshd_config.d directory (note the extra "d" in the directory name - sshd)?

Hi Andy,

that was the issue. There is no sshd_config.d folder, so I put my settings in the sshd_config file. That worked.



Please enter an answer

You can mention users to notify them: @username

You can use Markdown to format your question. For more examples see the Markdown Cheatsheet.

> I’m a blockquote.

I’m a blockquote.

[I'm a link] (https://www.google.com)

I'm a link

**I am bold** I am bold

*I am italicized* I am italicized

Community Code of Conduct