How to Disable SSH ROOT Login on Ubuntu 22.04

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.

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.

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:

#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:

#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:

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

Recommended Tutorials

AuthorDevendra Dode

Greetings, I'm Devendra Dode, a full-stack developer, entrepreneur, and the proud owner of Tutsmake.com. My passion lies in crafting informative tutorials and offering valuable tips to assist fellow developers on their coding journey. Within my content, I cover a spectrum of technologies, including PHP, Python, JavaScript, jQuery, Laravel, Livewire, CodeIgniter, Node.js, Express.js, Vue.js, Angular.js, React.js, MySQL, MongoDB, REST APIs, Windows, XAMPP, Linux, Ubuntu, Amazon AWS, Composer, SEO, WordPress, SSL, and Bootstrap. Whether you're starting out or looking for advanced examples, I provide step-by-step guides and practical demonstrations to make your learning experience seamless. Let's explore the diverse realms of coding together.

Leave a Reply

Your email address will not be published. Required fields are marked *