How to disable the Linux login banner

0
61
How to disable the Linux login banner

Looking to eke out as a lot safety as you possibly can out of your Linux servers? Jack Wallen exhibits you how one can restrict the info would-be ne’er-do-wells get by disabling the login banner.

Image: iStock/structuresxx

When you log in to Linux, both by means of SSH or the console, you’re greeted with a banner that provides up just a few necessary bits of knowledge. If you are doing the whole lot you possibly can to safe that Linux server, the info shared by that banner generally is a gold mine to ne’er do wells and would-be attackers. Information like kernel launch, distribution sort, obtainable updates, and extra may be revealed. 

So how do you stop that info from being displayed when customers log into your Linux techniques? Let me present you. 

SEE: Checklist: Securing digital info (TechRepublic Premium)

The only manner to do that is by means of making a per-user file that disables the login banner. To try this, log in to your Linux server and concern the command: 

sudo contact /dwelling/USER/.hushlogin 

Where USER is the title of the consumer who logs into the machine. The subsequent time that consumer logs in to the system, they’ll now not see the banner. That methodology works nice should you solely have just a few customers. 

If you are on a system that homes a lot of customers, you want a extra environment friendly manner of dealing with this activity. For that, you’ll first open the sshd_config file with the command: 

sudo nano /and many others/ssh/sshd_config

In that file, take away the # character earlier than the line PrintMotd no after which add the line PrintLastLog no beneath it. 

Save and shut the file. On Red Hat distributions, restart SSH with the command:

sudo systemctl restart ssh on Ubuntu distributions and sudo systemctl restart sshd

Next, open the PAM SSH config file with the command: 

sudo nano /and many others/pam.d/sshd

In that file, remark out (by including a # character) the line session optionally available pam_motd.so motd=/run/motd.dynamic and the line session optionally available pam_motd.so noupdate. 

With these configurations in place, it will not matter who logs into your Linux machine, they will not see the banner. This is only a tiny step ahead in gaining extra safety in your Linux servers, however even small progress continues to be progress.

Subscribe to TechRepublic’s How To Make Tech Work on YouTube for all the newest tech recommendation for enterprise professionals from Jack Wallen.

Also see

Source link