Enable Disable SSH Root Login Access in Ubuntu 20.0|22.04

[ad_1]

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 or allow and disable SSH root user login access in linux ubuntu command line or terminal.

How to Enable and Disable SSH Root Login Ubuntu 20.0|22.04 Command Line

There are the following ways to enable and disable ssh root login access in linux ubuntu 20.0|22.04 using command line or terminal:

  • Disable SSH Root Login Ubuntu
  • Enable SSH Root Login Ubuntu

Disable SSH Root Login Ubuntu

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 or command line 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 root user login. You can also see this by trying it.

When you try to login 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 following commands.

Now, open terminal or command line 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 root user login. You can also see this by trying it.

When you try to login 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.

Recommended Tutorials

[ad_2]

Jaspreet Singh Ghuman

Jaspreet Singh Ghuman

Jassweb.com/

Passionate Professional Blogger, Freelancer, WordPress Enthusiast, Digital Marketer, Web Developer, Server Operator, Networking Expert. Empowering online presence with diverse skills.

jassweb logo

Jassweb always keeps its services up-to-date with the latest trends in the market, providing its customers all over the world with high-end and easily extensible internet, intranet, and extranet products.

GSTIN is 03EGRPS4248R1ZD.

Contact
Jassweb, Rai Chak, Punjab, India. 143518
Item added to cart.
0 items - 0.00