• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
sharadchhetri

sharadchhetri

Tutorials On Linux, Unix & Open Source

  • Home
  • Linux Commands
  • Resources
    • Learn Linux
  • My WordPress plugins

how to deny root ssh access in linux server

June 30, 2013 by Sharad Chhetri Leave a Comment

how to deny root ssh access in linux server

For security point of view we generally restrict root direct ssh access in server.But keep in mind you also must have user who can access the server other than root.
So before doing this practical ,check if you have access to server with other user or else create a new user with password.

useradd username

passwd username

OK, now restrict the root from ssh follow the given below steps

Step 1 : Take the backup of sshd_config file

cp -p /etc/ssh/sshd_config  /etc/ssh/sshd_config.backup

Step 2: Edit the sshd_config file and search for keyword PermitRootLogin
Bydefault PermitRootLogin is yes. Change the PermitRootLogin yes to no

vi /etc/ssh/sshd_config

PermitRootLogin no

Step 3: After this change restart the ssh service.

In CentOs and Red Hat

/etc/init.d/sshd restart

In Debian and Ubuntu

/etc/init.d/ssh restart

Now you can check it, use command ssh root@server-ip-Or-FQDN

Share this:

  • Twitter
  • Facebook
  • More
  • Print
  • Email
  • LinkedIn
  • Reddit
  • Tumblr
  • Pinterest
  • Pocket
  • Telegram
  • WhatsApp
  • Mastodon

Related posts:

  1. How to install own git server with ssh and http access by using gitolite and gitweb in CentOS
  2. Non interactive ,without typing password do ssh to Server : By sshpass
  3. Change the default port number of ssh server
  4. How to install ssh server on Ubuntu
  5. Allow root ssh login in FreeBSD 9.0
  6. run command in remote linux / unix system by using ssh
  7. Agent admitted failure to sign using the key ssh
  8. How to enable direct ssh to EC2 linux instance without keypair file
  9. rsync over ssh port number on Linux/Unix system
  10. Protect ssh with Google Authenticator on Ubuntu 14.04 LTS

Filed Under: Linux, SSH Tagged With: ssh

Reader Interactions

Leave a Reply Cancel reply

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

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Primary Sidebar

Our Social Media Presence

  • Facebook
  • GitHub
  • Twitter

Linux Command

What is Linux Internal And External Command

Linux Basic Commands With Examples For Every Beginner

tr command to convert lines to space , tab and vertical tab

smbpasswd command not found on CentOS 7 and RHEL 7

Solution : semanage command not found

Unix / Linux : How to print duplicate lines from file

More Posts from this Category

You Might Like These Articles!

simplecodesyntax wordpress plugin

SimpleCodeSyntax : My Another WordPress Plugin

Install Nginx

How To Install Nginx On Ubuntu 22.04 LTS

Install Latest Git package in Ubuntu Operating System

How To Always Install Latest Git Package In Ubuntu Operating System

Bash script for installing VirtualBox on Ubuntu 22.04 LTS Desktop

Install VirtualBox On Ubuntu 22.04 LTS Desktop (Bash Script)

libfuse

dlopen(): error loading libfuse.so.2 – Got Error On Ubuntu

Failed to open/create the internal network

VirtualBox Error: Failed to open/create the internal network

Always Useful Tips And Tricks

How To Get SSH Public Key Fingerprint Information

Show visitor ip address php code

curl command to check the http status

How to use grep command to get fixed pattern or exact keyword

How to convert float to integer number

Allow only members of Wheel group to use su command on RHEL/CentOS

Allow wget and yum in iptable

Explore 90+ Article On "Linux Tips And Tricks"

Copyright © 2023 ยท
The material in this site cannot be republished either online or offline, without our permission.
Proudly Blogging From Bharat.

  • Contact
  • About Me
  • My WordPress plugins
  • Privacy Policy