No announcement yet.

How to disable root login in Linux server?


Ads on showthread pages

  • Filter
  • Time
  • Show
Clear All
new posts

  • How to disable root login in Linux server?

    WordPress Hosting on SSD Servers

    To disable root login please perform these steps:

    1. SSH into your server as ‘admin’ and gain root access by su.
    2. Edit this file for SSH logins: vi /etc/ssh/sshd_config
    3. Find the line: Protocol 2, 1
    4. Uncomment it and change it to: Protocol 2
    5. Next, find the line: PermitRootLogin yes
    6. Uncomment it and change it to: PermitRootLogin no
    7. Save the file to apply changes.
    8. Now you can restart SSH
    /etc/rc.d/init.d/sshd restart

    Now, no one will be able to login to root with out first loggin in as admin and ‘su -‘ to root, and you will be forcing the use of a more secure protocol. Just make sure you remember both passwords!

    Note: If you are using cPanel server make sure you have added admin user to the ‘wheel’ group so that you will be able to ‘su -‘ to root, otherwise you may lock yourself out of root.


    Shane G.
Sign up for a News Letter Click here to sign up