Disable Direct Root Login and User Access via SSH to Server

Everybody knows, including hackers and attackers that all Linux and UNIX flavored systems come with a all powerful root user account, which once get compromised, mean all hell breaks loose. So it’s a good security practice to disable the ability for root user to able to login and gain access to the server system via SSH directly (of course, the system must have disabled FTP access). After disabling direct root SSH remote login, the chance for the brute force hacking to success is greatly reduced.

To turn off and disable direct root SSH login, follow this simple tutorial:

IMPORTANT: Make sure you have another account (preferably belongs to wheel user group too) which is able to login via SSH remotely, and able to SU to root user account. Else you risk been locked out from your server.

  1. SSH into server and login as root.
  2. In command shell, use pico or vi to edit sshd_config file by typing one of the following commands:

    pico /etc/ssh/sshd_config
    vi /etc/ssh/sshd_config

  3. Scroll down the SSH server configuration file and locate a line like below:

    #PermitRootLogin yes

  4. Uncomment the line by removing the hash symbol (#), and then change the “yes” to “no”. The final line should look like below:

    PermitRootLogin no

  5. Save the config file. In pico, press Ctrl-o, follow by Ctrl-x. In vi, type :wq and press Enter.
  6. Restart SSH server by typing the following command in command line, and press Enter:

    /etc/rc.d/init.d/sshd restart

  7. Logout from SSH connection. Try to login as root, it should fail with Access denied error. To access root account, login with your own user name and password, and then SU to root.

Leave a Reply

You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Subscribe to comments feature has been disabled. To receive notification of latest comments posted, subscribe to My Digital Life Comments RSS feed or register to receive new comments in daily email digest.
Custom Search

New Articles

Incoming Search Terms for the Article

ssh root access denied - linux no root login - freebsd disable root login - linux disable remote root login - disable remote root login linux - linux disable root remote login - disable remote root login - disable the SSH daemon iphone - iphone disable ssh daemon - allow remote root login linux - disable remote login linux - how to disable remote root login - allow root to login remotely on linux - linux disable root - freenas ssh access denied - remote logins disabled for root - disable user login password in vista - disable remote login root - ssh host deny iphone - how to disable remote root access on linux server - linux root Access denied - ssh root login disable - How do you disable Remote root login in Linux - freebsd enable root - ssh disable remote root login - iphone disable root ssh - freebsd ssh root login - iphone how to change the root password disable the SSH daemon - red hat prevent direct remote login ssh config - disable root remote - FreeBSD allow remote access as root - how to do this in starting a user account is diseable in xp through 2003 server - redhat disable login - disable ssh for users login - ssh direct login not allowed - disable direct root access - sshd disable root remote debian - disallow ssh user linux - freebsd disable remote root login - linus how login as root using command line - Linux CentOS 5 restrict root remote access - oscdimg -m -bD:\expandedSetup\boot\etfsboot.com -h -u2 -m -lWIN_EN_DVD D:\expandedSetup\ D:\win7.iso - suse linux restrict root remote login - windows server 2003 root access ssh - access denied freebsd password is correct - aix prevent direct user login via ssh - command disable ssh - debian ssh config disable root login - disable remote root login in linux - disable ssh access for user -