It’s a good idea how to disable SSH remote login on the server for security reasons. You just need to make a small change in the configuration file and give ssh access without a password login. you can create a user to give access on the server with username and password in the Linux server. Sometimes, you will see ssh root login permission denied please try again.
How To Disable SSH For Remote Server:
We can do this because of security purposes on the server and should not allow the root login on the server because the default user is root. we can have a remote session of the server by creating a new user and assign the root permission to the user.
Step 1: Create a user on Linux using the below command.
[root@master-node ~]# useradd test [root@master-node ~]# grep test /etc/passwd test:x:1000:1000::/home/test:/bin/bash
If you want to give sudo permission then you have to add ‘test’ user in the wheel group.
[root@master-node ~]# usermod -G wheel test [root@master-node ~]# grep test /etc/group wheel:x:10:test
Step 2: you want to run this user as root executes the command. So, we have to add this user in /etc/sudoers
[root@master-node ~]# echo 'test ALL=(ALL) ALL' >> /etc/sudoers
Check Out: How To Install OpenSSH
Step 3: So, they do work using their credentials and it will be easier for you to identify what they’re doing and what they have done. you can apply an ssh connection timeout for a remote session in the Linux server.
Now make some changes in the ssh configuration file.
Change PermitRootLogin “Yes” to “No”
Check Out: Create SSH Key
Save the file and restart the sshd service using the below command.
[root@master-node ~]# systemctl restart sshd
You’re done ssh login without password permission denied please try disable ssh remote login ssh root login