How to restrict the SSH login to a specific ip or host?
Jump to navigation
Jump to search
Step 1:- Login to the server
ssh username@ip -p portnumber
Step 2:- Find the hosts.deny file in /etc
cd /etc/ vi hosts.deny
Include the following line sshd: ALL Save & exit the file
Step 3:- Find hosts.allow file in /etc
vi hosts.allow
Include the following line
sshd: required ip
Save & exit the file
Note: We can login the server through the particular ip as mentioned on hosts.allow file
Step 4:- Exit the server.