Skip to content

Instantly share code, notes, and snippets.

@AbdullahGhani1
Last active February 6, 2024 12:27
Show Gist options
  • Save AbdullahGhani1/63d4a2c7578a86da8e2dad54b4e4bd22 to your computer and use it in GitHub Desktop.
Save AbdullahGhani1/63d4a2c7578a86da8e2dad54b4e4bd22 to your computer and use it in GitHub Desktop.
Disable Root Login -KodeKloud

Disable Root Login

After doing some security audits of servers, xFusionCorp Industries security team has implemented some new security policies. One of them is to disable direct root login through SSH. Disable direct SSH root login on all app servers in Stratos Datacenter.

Click on ✔ and Do Task Again

Solution:-

Open Three Terminal and ssh on all App server

on Terminal one
ssh tony@stapp01  
on Terminal Two
ssh steve@stapp02
on Terminal three
ssh banner@stapp03
Run the below command on each app server and Search for #PermitRootLogin yes
sudo vi /etc/ssh/sshd_config
Remove the "#" and change "yes" to "no" according to image

image

sudo systemctl restart sshd
@joshua-demebo
Copy link

Nice on, it works like magic

@erjan
Copy link

erjan commented Feb 6, 2024

but i can still root login when i m under tony on stapp01.

if i m tony on stapp01 i can do 'sudo su - ' - and still be root.

however if i totally out of stapp01 - and do
ssh root@stapp01 - then 'permission denied'

is this how it works?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment