How to Disable SSH ROOT Login on Ubuntu 22.04

[ad_1]

To disable root login ssh access on Ubuntu 22.04, you need to add “PermitRootLogin no” to the SSH configuration file, you can do this by opening the ssh configuration file using the command sudo nano /etc/ssh/sshd_config on terminal window.

Ezoic

In this tutorial, we will show you how to disable root login ssh access on ubuntu 22.04. And as well as, we will also provide video guide for it.

How to Disable SSH ROOT Login on Ubuntu 22.04

Here are steps for disabling ssh root login on Ubuntu 22.04:

Step 1: Start the Terminal Window and Switch to the Root User

Firstly, press ctrl + alt + t on the keyboard to start the terminal window.

Ezoic

Next, type this command on terminal to switch to root user:

sudo -i

Step 2: Edit the SSH configuration File

Now, Edit the ssh configuration file, you can use this on this command terminal:

sudo nano /etc/ssh/sshd_config

Step 3: Search the PermitRootLogin line

Now to disallow ssh root user login access, you need to search “PermitRootLogin” in the configuration file:

Ezoic

#LoginGraceTime 2m
PermitRootLogin yes
#StrictModes yes
#MaxAuthTries 6

Step 4: Change PermitRootLogin to no

To Disable root login access ssh, you need to change PermitRootLogin yes to no in the configuration file:

Ezoic

#LoginGraceTime 2m
PermitRootLogin no
#StrictModes yes
#MaxAuthTries 6

Save and close this file from terminal.

Step 5: Restart ssh Services

Type these commands on terminal window to restart the ssh service:

Ezoic

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

Here is the video for Disable Root Login SSH Ubuntu 22.04

Conclusion

That’s it, 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.

Ezoic

Recommended Tutorials

Ezoic

[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.

Contact
Jassweb, Rai Chak, Punjab, India. 143518