• For one reason or another RHEL does not disallow incoming ssh connections as root. This is, of course a glaring security problem which should be addressed for all systems that allow ssh connections to be made from any but the most restricted networks.

    The best practice, of course, would be to make the initial ssh connection as an unprivileged user and then use the “su” command to promote yourself to root. This way, even if an attacker managed to get into the system, it would be as an unprivileged user and they would not able to do much harm. Allowing incoming ssh connections at root leaves you much more exposed to attack. Granted your root password is still protecting you, but it becomes your only layer of defense.

    Ok, so how do we disallow incoming ssh connections as root on our RHEL box?

    First, edit “/etc/ssh/sshd_config”

    Find the section of the file that looks like this:

    # Authentication:
    #LoginGraceTime 2m
    #PermitRootLogin yes
    #StrictModes yes
    #MaxAuthTries 6

    Change this line:
    #PermitRootLogin yes

    To this:
    PermitRootLogin no

    Restart sshd:
    /sbin/service sshd restart

    This entry was posted on Monday, April 30th, 2007 at 11:45 am and is filed under Data and Technology. You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.
  • 2 Comments

    Take a look at some of the responses we've had to this article.

    1. Apr 9th
      Reply

      Thanks for the info, the every handy google led me to this article.

      I should keep my own notes realy :P

    2. Jun 2nd
      Reply

      Yeah, I was just looking in my logwatch and I saw some people tried to log in – into SSH with root.. which they can’t log in with.

      I have to log in with a User and then do “sudo su -” for root.

      @Buzz: Make sure you actavate “sudo” too for extra security. If you search “centos using sudo” at google youll find many websites who will explain how to use it.

  • Leave a Reply

    Let us know what you thought.

  • Name (required):

    Email (required):

    Website:

    Message:

Visitors have tagged this post: t (364) - sshd_config root (161) - ssh_config root (78) - sshd root (75) - rhel ssh (41) - rhel disable root login (32) - f (28) - disable root login redhat (27) - sshd_config root login (27) - RedHat disable root login (24) - ssh root (23) - turn off ssh (21) - sshd_config disable root (20) - redhat ssh root login (20) - rhel enable ssh (19) - how to disable ssh (18) - disallow root ssh (18) - spiralbound net (18) - dropbear disable root login (17) - sshd: root [net] (17) - incoming (16) - disable ssh (16) - dropbear root login (16) - solaris ssh root (15) - sshd root login (15) - linux disable ssh (14) - connections (14) - disable ssh redhat (13) - how to disable SSH in Linux (13) - enable ssh RHEL (13) - rhel root login (13) - ssh root solaris (13) - turn off root ssh (12) - rhel ssh root (12) - disabling ssh in linux (12) - dropbear root (12) - ssh_config root login (12) - rhel4 enable ssh (11) - disable root ssh (11) - RHEL4 SSH (11) - rhel disable root ssh (11) - RHEL5 ssh (11) - sshd allow root (11) - rhel restart sshd (10) - rhel 5 ssh (10) - enabling ssh for root (10) - RHEL root ssh (10) - SSH RHEL (10) - disable ssh for root (10) - how to enable ssh in rhel5 (10) - RHEL SSH login without password (10) - enable ssh on RHEL (10) - RHEL sshd (9) - sshd_config allow root (9) - SSH disable root (9) - how to disable ssh on linux (9) - ssh_config disable root (9) - redhat ssh root (9) - redhat enable ssh (9) - enable ssh redhat 5 (9) - ssh config root (9) - ssh disallow root (8) - how to enable ssh in rhel4 (8) - redhat allow root ssh (8) - sshd_config disable root login (8) - dropbear disable root (8) - disallow ssh (8) - disable root login red hat (8) - how to enable ssh in RHEL 5 (8) - redhat enable root ssh (8) - disable ssh authentication (7) - enable root ssh redhat (7) - rhel5 disable root ssh (7) - how to enable ssh in redhat (7) - enable ssh redhat (7) - ssh rhel 4 (7) - rhel 4 ssh (7) - enable SSH on RHEL 4 (7) - enable root ssh (7) - solaris "root ssh" (7) - disable root login rhel (7) - redhat root ssh login (7) - disable ssh root login (7) - RHEL 5 disable root login (7) - rhel sshd restart (7) - rhel4 sshd (7) - RHEL5 enable ssh (7) - how to enable ssh in redhat linux (7) - enable ssh in rhel (7) - how to enable ssh redhat (7) - redhat 5 enable ssh (7) - red hat 5 ssh (7) - enable ssh on rhel5 (7) - redhat disable ssh (7) - ssh in RHEL (6) - disable ssh login (6) - restart ssh redhat (6) - disabling ssh access (6) - solaris allow root ssh (6) - sshd_config root disable (6) - sshd disable root (6) - ssh root login redhat (6) - solaris ssh root login (6) - ssh disallow root login (6) - enable root login redhat (6) - disallow root login ssh (6) - rhel 5 enable ssh (6) - disable root ssh RHEL (6) - sshd_config disallow root (6) - allow root to ssh (6) - disabling ssh linux (6) - how to enable ssh on RHEL4 (6) - enable ssh in redhat 4 (6) - enable ssh on rhel 5 (6) - redhat root login ssh (6) - sshd_conf root (6) - ssh_config allow root (6) - redhat 5 ssh (6) - enable ssh RHEL 5 (6) - RHEL disallow root login (6) - restart ssh RHEL (5) - redhat disable root (5) - ssh disable (5) - disable ssh root (5) - restart sshd "rhel" (5) - RHEL ssh access (5) - allow root ssh (5) - disable root access RedHat (5) - disable ssh on linux (5) - sshd_config rhel (5) - rhel5 ssh ROOT (5) - ssh turn off password (5) - redhat disable ssh login (5) - RHEL enable root ssh (5) - turn off ssh linux (5) - RHEL ssh enable (5) - redhat enable ssh root (5) - how to enable SSH in Linux (5) - solaris enable root ssh (5) - ssh + rhel4 (5) - linux disable ssh login (5) - disable ssh for user (5) - ENable SSH in RHEL4 (5) - disallow ssh access (5) - redhat enable ssh login (5) - enable ssh in RHEL 4 (5) - enable ssh root redhat (5) - solaris 10 ssh root (5) - enable SSH on redhat 5 (5) - red hat enable ssh (5) -