Skip to main content

How to Disable SSH Root Login in GNU/Linux:-

How to Disable SSH Root Login in GNU/Linux:-
--------------------------------------------
As we all know, root SSH login is enabled by default in GNU/Linux. We can easily access our remote servers and manage them if they have any issues via SSH. But it is not advisable to allow directly login as root user via SSH, because anyone can brute force root password and will try to access your servers.

It’s better to have a separate user account and you can get root privileges by using su command if necessary. This handy tutorial will describe you how to disable root SSH login in GNU/Linux systems.

Disable SSH Root Login

Open up the SSH configuration file in any editor:

# nano /etc/ssh/sshd_config

Search for the line “PermitRootLogin” and change the value from yes to no:

[...]
PermitRootLogin no
[...]

Save and close the file. Restart sshd service to take effect the saved changes:

# /etc/init.d/ssh restart

Now try to login as root user from any client systems. You will an error message like below:

How to Disable SSH Root Login in GNU/Linux
$ ssh root@192.161.10.20/24
root@192.161.10.20/24 password: 
Permission denied, please try again.
 
Limit SSH users:-

If your servers is having large number users, 
you can decide which can able to access the 
server via access. 
To do that open up the SSH configuration file:

# nano /etc/ssh/sshd_config

At the end of file add the line “AllowUsers”.
Add the users separated by a space as shown below.
For example here,
I added the users "Shubham" and "shah",
to access the servers via SSH:[...]
AllowUsers Shubham Shah
[...]
Restart sshd service:

# /etc/init.d/ssh restart

Now try to login via SSH from some others except 
Shubham Shah.
For instance here I am going to access with user Ram:-
$ ssh ram@192.161.10.20/24 ram@192.161.10.20/24's password: 
Permission denied, please try again.
----------------------------------------------------
Source:-Unixmen.com
Limit SSH users
If your servers is having large number users, you can decide which can able to access the server via access. To do that open up the SSH configuration file:
# nano /etc/ssh/sshd_config
At the end of file add the line “AllowUsers”. Add the users separated by a space as shown below. For example here I added the users sk and senthil to access the servers via SSH:
[...]
AllowUsers sk senthil
[...]
Restart sshd service:
# /etc/init.d/ssh restart
Now try to login via SSH from some others except sk and senthil. For instance here I am going to access with user
- See more at: http://www.unixmen.com/how-to-disable-ssh-root-login-in-gnulinux/#sthash.G1XdwGcu.dpuf

Comments

Popular posts from this blog

10 Best Forum Software For Webmasters

10 Best Forum Software For Webmasters Do you want to create your online discussion forum or online community where people can discuss about their favorite topics? In this article, you can see 10 best forum software (scripts for setting up discussion forums) that can be used free of cost. Although some scripts are paid but rest of these forum scripts are free to use.You only need to buy hosting space and domain name for your website and after then you can install any of these forum scripts to start your own discussion forums on the internet. Online discussion forums generate huge page views because thousands of people want to join online discussion forums to ask questions or share knowledge. Some of online marketers join forums to discuss about their products with community members. You don't need to acquire any kind of technical skill to run a professional discussion forums because these days, almost all web hosting providers offer one click script installer which h...

How to Hack WhatsApp using just a GIF

A picture is worth a thousand words, but a GIF is worth a thousand pictures. Today, the short looping clips, GIFs are everywhere—on your social media, on your message boards, on your chats, helping users perfectly express their emotions, making people laugh, and reliving a highlight. But what if an innocent-looking GIF greeting with Good morning, Happy Birthday, or Merry Christmas message hacks your smartphone? Well, not a theoretical idea anymore. WhatsApp has recently patched a critical security vulnerability in its app for Android, which remained unpatched for at least 3 months after being discovered, and if exploited, could have allowed remote hackers to compromise Android devices and potentially steal files and chat messages. WhatsApp Remote Code Execution Vulnerability The vulnerability, tracked as  CVE-2019-11932 , is a double-free memory corruption bug that doesn't actually reside in the WhatsApp code itself, but in an open-source GIF image parsing library that What...

WhatsApp Bug Allows Malicious Code-Injection, One-Click RCE

A high-severity vulnerability could allow cybercriminals to push malware or remotely execute code, using seemingly innocuous messages. Security researchers have identified a JavaScript vulnerability in the WhatsApp desktop platform that could allow cybercriminals to spread malware, phishing or ransomware campaigns through notification messages that appear completely normal to unsuspecting users. And, further investigation shows this could be parlayed into remote code-execution. The desktop platform has more than 1.5 billion monthly active users. The high-severity bug (rated 8.2 on the CVSS severity scale) could impact those that also use WhatsApp for iPhone, if they don’t update their desktop and mobile apps, and if they don’t use newer versions of the Chrome browser. “A vulnerability [ CVE-2019-18426 ] in WhatsApp Desktop versions prior to 0.3.9309 when paired with WhatsApp for iPhone versions prior to 2.20.10 allows cross-site scripting (XSS) and local file reading,” acc...