Using the following files, I have attempted to restrict the SSH remote login. Having lack of knowledge in linux environment, I don't know the drawbacks and vulnerabilities between the following ways. So I want to know the internal works between these files and process.
Experts please share your experience with me.
SSHD_CONFIG I found this file ssh_config in the /etc/ssh/ folder. If I have added the following line. I could restrict the root user remote access as well as I could allow the user I want to access with the max session I wanted.
vim /etc/ssh/ssh_config
PermitRootLogin no
AllowUsers jack joe
MaxSessions 5
HostDeny File
Just appended the user IP in the following file.
vim /etc/hosts.deny
192.168.5.*
PAM Folder : In the PAM folder, I have added the user who are all not allowed to authenticate to access remote ssh.
vi /etc/pam.d/ssh
auth required pam_listfile.so item=user sense=deny file=/etc/sshd/sshd.deny onerr=succeed
vi /etc/sshd/sshd.deny