Securing SSH access to my CentOS server

Discussion in 'Server Operation' started by Darwin Cleveland, Mar 17, 2024.

  1. Darwin Cleveland

    Darwin Cleveland New Member

    Hi everybody,

    I am currently working on securing SSH access to my CentOS server, and I need some help with best configuration practices. I want to enhance the security of my SSH connections to protect my server from unauthorized access and potential security threats.

    please let me know.

    Thank you
     
  2. ahrasis

    ahrasis Well-Known Member HowtoForge Supporter

    https://www.google.com/search?client=firefox-b-d&q=how+to+secure+ssh

    Just google and read. They are all known good practices to secure ssh. I'd personally allow key only access to my servers and use different port to access it.

    Specific IP and device (MAC) access seems the highest among them all and some may want go up to that level of security for their own reasons, however, they are not very convenient in cases like the admin want to log using different IP or has lost that specific IP or the device, he then might need to physically access the server to fix that.
     
    pyte likes this.
  3. pyte

    pyte Well-Known Member HowtoForge Supporter

    Depending on your setup you should these things:
    • Change the default ssh port
    • Restrict access to the ssh port with a firewall
    • Use key-based auth
    • Enforce strict host key checking
    • Use strong keys with ed25519
     
    Th0m and ahrasis like this.
  4. wileywalker

    wileywalker New Member

    SSH comes reasonably secure out of the box. you will want to disable passwords (PasswordAuthentication no) however and use public key authentication.

    The best way is to read through man sshd_config and understand each configuration option.

    For the more paranoid you should regularly scan your ssh server for vulnerabilities. there are a lot of options, here is one of the simpler ones: https://www.sshaudit.com/
     
    ahrasis likes this.

Share This Page