---
title: Disable or Restrict Root Login via SSH on Linux
url: https://docs.vultr.com/disable-or-restrict-root-login-via-ssh-on-linux
description: Learn how to enhance your Linux server security by disabling or restricting root login via SSH. Step-by-step guide with best practices for administrators.
publish_date: 2014-09-25T00:00:00Z
last_updated: 2023-11-21T20:23:53.475535Z
header_image: https://docs.vultr.com/public/doc-assets/8/928bbb8dfe027633.png
---

> Index of every Vultr Docs page in markdown: https://docs.vultr.com/llms.txt

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 Vultr 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
