• Domains
  • Web Hosting
  • WordPress Hosting
  • Reseller Hosting
  • Cloud VPS
  • Dedicated Servers
  • Domains
  • Web Hosting
  • WordPress Hosting
  • Reseller Hosting
  • Cloud VPS
  • Dedicated Servers
home/Knowledge Base/Dedicated Servers/Linux Guides/Disable or Restrict Root Login via SSH on Linux
Popular Search:Dedicated Server, CentOS, Web Hosting

Disable or Restrict Root Login via SSH on Linux

19 views 0 December 6, 2019 aklwebhost

Allowing root login over SSH is commonly considered a poor security practice throughout the tech industry. Instead, you could perform sensitive administrative tasks by connecting with a user account and executing commands using sudo.

Disable root access

View the contents of the SSH configuration file using the following command.

cat /etc/ssh/sshd_config

In this file you will find the following line:

#PermitRootLogin no

Un-comment the line using your desired editor. Then restart the SSH service for the changes to take effect.

/etc/init.d/ssh restart

Please note that login to the root account will still be possible via the AKLWEB HOST console.

Restrict root access by IP address

As previously mentioned, a good security practice is to not allow root access via SSH at all. However if root access is absolutely necessary, you can restrict it by IP address.

To restrict root access to a specific IP address add the following line to the sshd_config file (substitute xxx.xxx.xxx.xxx for the IP address).

AllowUsers root@xxx.xxx.xxx.xxx

Restart the SSH service for the changes to take effect.

/etc/init.d/ssh restart
Tags:Disable or Restrict Root Login via SSH on Linux

Was this helpful?

Yes  No
Related Articles
  • Setup Spigot Server on Arch Linux
  • How To Install OSSEC HIDS on a CentOS 7 Server
  • Initial Setup of a CentOS 7 Server
  • Using StrongSwan for IPSec VPN on CentOS 7
  • Hot Backups with Percona XtraBackup on the One-Click WordPress App
  • Installing Rust on Ubuntu 14.04
Leave A Comment Cancel reply

Linux Guides
  • Disable or Restrict Root Login via SSH on Linux
  • Setup Spigot Server on Arch Linux
  • How To Install OSSEC HIDS on a CentOS 7 Server
  • Initial Setup of a CentOS 7 Server
  • Using StrongSwan for IPSec VPN on CentOS 7
  • Hot Backups with Percona XtraBackup on the One-Click WordPress App
View All 190  
Popular Articles
  • Using StrongSwan for IPSec VPN on CentOS 7
  • Disabling SSDP (Linux / Windows)
  • Can I pay by Western Union?
  • Can a Coupon Code Discount Be Carried Forward While I Upgrade My VPS Account
  • Can I pay multiple due invoices using a single transaction?
KB Categories
  • Billing
  • Cloud Hosting
  • CMS Hosting
  • cPanel/WHM Control Panel Guide
  • Dedicated Servers
    • AMD Opteron 6272
    • Arch
    • Backup Storage
    • Bandwidth
    • Basic Security
    • BSD
    • CentOS
    • Containers
    • CoreOS
    • DDoS Protection
    • Debian
    • Dedicated Server Control Panel
    • Intel Core i5 3550
    • Intel Core i5 4570
    • Intel Core i7 3770
    • Intel Core i7 4770
    • Intel Xeon E3 1230 V3
    • Intel Xeon E3 1245 V2
    • IP Space
    • Linux Guides
    • Minecraft
    • Networking
    • Server Apps
    • Server Troubleshooting
    • Ubuntu
    • Windows Guides
    • Windows Server 2008
    • Windows Server 2012
  • Domain Names
  • Email Support Documentation
    • Setup IMAP or POP
    • User Features – How To
    • Webmail – How To
  • FTP (File Transfer Protocol
    • CuteFTP Guide
    • FileZilla Guide
  • Game Servers
  • MySQL and MariaDB
  • Node.js
  • Plesk Web Hosting Guide
  • VPS Server
  • Web Servers

  Deploy a Meteor Application on Ubuntu

Disabling SSLv3  

  • Privacy Policy
  • Terms of Use
  • © 2022 AKLWEB HOST LLC, All Rights Reserved.

Popular Search:Dedicated Server, CentOS, Web Hosting