There are always a lot of bots trying to access to every vps, even when it's just registered right now, and no matters how many ips you ban, they will keep trying.so can I just allow ssh access entering a domain which points to my vps instead of entering the ip? something similar like virtualhosts work.I doubt about it, since even when you connect entering a domain, it resolves the pointed ip address, so it wouldn't connect in case I deny connection via IP...so would be another way to make my idea possible?
Deny access to SSH via server's IP
ssh;ip
I'm not exactly sure if this is what you mean, but yes, you can define the allowed client hosts by hostname.Option 2 is to use AllowUsers in sshd_config, it supports an optional hostname, here we allow someone to access only from foo.bar.com:AllowUsers ilkka@foo.bar.com(ssh_config(5) documents the allowed hostname patterns)The other option is to use hosts.allow and hosts.deny (tcpwrapper). To only allow ssh from foo.bar.com.# hosts.allowsshd: foo.bar.com# hosts.denysshd: ALLI think at least sshd should check that the client IP's reverse domain lookup matches the forward lookup for that name, but I'm not sure.