Skip to content
  • Homepage
  • HTML
  • CSS
  • Symfony
  • PHP
  • How to
  • Contact
  • Donate

Teach Developer

Articles, Guides & Tips

Enable or Disable SSH Root Login Access in Linux

Home  »  How to • Linux • SSH   »   Enable or Disable SSH Root Login Access in Linux
Posted on September 12, 2022September 17, 2022
793

SSH Root user login access is enabled in any system by default. Or we are asked while installing a system. that you have to enable or disable ssh root user login access. And you never know how to enable and disable ssh root user login access. So in this tutorial, we will show you how you can enable and disable SSH root user login access from the command line.

Enable or Disable SSH Root Login Access in Linux

Use the following ways to enable or disable ssh root login access in Linux:

  • Disable SSH Root Login
  • Enable SSH Root Login

Disable SSH Root Login

If SSH root user login access is enabled in your system and you do not know how to disable SSH root user login. So you can disable root user login access using the following commands.

First of all, open the terminal and execute the following command into it to open the main ssh configuration file /etc/ssh/sshd_config:

vi /etc/ssh/sshd_config

In the file opened with the upper command, search for the following line:

#PermitRootLogin no

Remove the ‘#‘ from the beginning of the line. Make the line look similar to this:

PermitRootLogin no

After that restart your server. So that is what you have changed in your file. It makes changes done:

# systemctl restart sshd
OR
# /etc/init.d/sshd restart

After all, you’ve now disabled the SSH root user login. You will no longer be able to access the root user login. You can also see this by trying it.

When you try to log in with the root user, Denied will be displayed in your terminal. Why have you disabled your root user login access?

Enable SSH Root Login

If SSH root user login access is disabled in your system and you do not know how to enable SSH root user login. So you can enable root user login access using the following commands.

Now, open a terminal and execute the following command into it to open the main ssh configuration file /etc/ssh/sshd_config:

vi /etc/ssh/sshd_config

In the file opened with the upper command, search for the following line:

#PermitRootLogin yes

Remove the ‘#‘ from the beginning of the line. Make the line look similar to this:

PermitRootLogin yes

After that restart your server. So that is what you have changed in your file. It makes changes done:

# systemctl restart sshd
OR
# /etc/init.d/sshd restart

After all, you’ve now enabled the SSH root user login. You will be able to access the root user login. You can also see this by trying it.

When you try to log in with the root user, The Access grant will be displayed in your terminal. Why have you enabled your root user login access?

Conclusion

Through this tutorial, You have learned how to enable and disable ssh root login and limit ssh access in Linux.

How to, Linux, SSH

Post navigation

Previous Post: How to Symfony parameters and environment variables use
Next Post: How to Delete and Remove Files on Ubuntu Linux Terminal

Related Posts

  • How to check PHP version using the command line
  • How to trigger a button click from another button click event with JavaScript?
  • How to increase browser zoom level on page load with CSS?
  • How to Disable WordPress Auto Update? Turn Off WordPress Auto Updates
  • How to Create Live Search in HTML table with jQuery
  • How to Object Destructuring in ES6

Categories

  • Codeigniter (3)
  • CSS (11)
  • eCommerce (1)
  • Framework (1)
  • Git (3)
  • How to (43)
  • HTML (5)
  • JavaScript (15)
  • Jquery (7)
  • Laravel (1)
  • Linux (4)
  • Magento-2 (1)
  • Node js (4)
  • Others (2)
  • PHP (11)
  • React (13)
  • Server (1)
  • SSH (3)
  • Symfony (6)
  • Tips (16)
  • Top Tutorials (10)
  • Ubuntu (3)
  • Vue (1)
  • Wordpress (7)

Latest Posts

  • What is SSH in Linux?
  • How to Delete Files in Ubuntu Command Line
  • How to Deploy a React application on a cPanel
  • How to use events listeners and Event Subscriber in Symfony
  • How to Convert PHP CSV to JSON

WEEKLY TAGS

AJAX (1) Codeigniter (1) Javascript (11) JQuery (1) PHP (16) Programming (1) React (3) Symfony (1)

Random Post

How to change password in the CodeIgniter framework
How to Delete Files in Ubuntu Command Line
4 Methods to Search an Array
Here are 10 platforms where you can find your next remote job as a developer.
How to Check Twig Version in Symfony

Quick Navigation

  • About
  • Contact
  • Privacy Policy

© Teach Developer 2021. All rights reserved