Restricting SSH access to 2 or 3 specific IPs
I am trying to restrict SSH access to two maybe three IP's.
One of the forum analysts suggested this when asked to block one specific IP
Hello :)
You can use a custom "AllowUsers" entry in the /etc/ssh/sshd_config file to limit access to specific IP addresses for specific users. EX:
Code:
AllowUsers root@1.2.3.4 cptest1
This above entry would allow root access from IP 1.2.3.4 and the "cptest1" user access from any IP address.
Well my I followed this instruction but I want to add one more IP and make it only possible to logon from two IP's as root and otherwise you must use created "accountuser" like in this example cptest1 which in turn is allowed to logon but not as root but is capable to get su - rights to change to root when logged on.
What is the smartest and securest way to handle this ?
Do I use the command line or the WHM control panel menu;s ?
-
Hello, The "AllowUsers" option allows multiple entries on the same line, separate by spaces. EX: AllowUsers root@1.2.3.4 root@2.3.4.5
You may also find this thread helpful: [Tutorial] Interested in increasing the security of your server? Read this. (sshd hardening) Thank you.0 -
You can do this easiliy is Host Acess Control. In the first box type SSHD in the second input your IP and in the third ALLOW. Add subsequent entries for your IP's then the final entry should be SSHD, ALL, DENY 0 -
You can do this easiliy is Host Acess Control. In the first box type SSHD in the second input your IP and in the third ALLOW. Add subsequent entries for your IP's then the final entry should be SSHD, ALL, DENY
Hello @keat63, This will only restrict SSH access to specific IP addresses. The request on this thread relates to restricting SSH access to both usernames and IP addresses. Thank you.0
Please sign in to leave a comment.
Comments
3 comments