Disabling SSH login on CentOS

    • Pretty sure that simply using a DenyUsers line in your /etc/ssh/sshd_config will work. But be VERY careful editing that file as you can disable SSH logins completely if you don't know what you are doing and then you have to have IPMI or KVM access to the system to recover.

      I think there is already an example at the bottom of that file that I put in place for you.

      DenyUsers username1 username 2 username 3

      By the opposite token, you can set it up to only grant SSH access to certain users
      AllowUsers username1 username2

      But you don't use both, you have to choose one or the other methods.

      This is not limited to CentOS, but works with any of the Linux releases.