How to configure a user to SSH login only through an special IP?

for example:

A user named ‘guest’ can SSH through the full IP segment.

A user named ‘admin’ can SSH access only through a few specific IPS.

for example:
a user named ‘admin’ only can be access only through ip 192.168.1.2

how to configure?

Hello @13418485892 , I believe this is not implemented, but you can use RADIUS authentication and create logic by several criterias as you want.

⚓ T971 authentication public-keys options quoting issue is the Phabricator ticket about this feature. I went looking for it a while ago too because I also wanted to be able to restrict users to certain IPs and found that it isn’t currently possible.

Thank you for your reply

After much research and testing and more tests, specifically with the commands telnet and login, I discovered something I did not know; when the SSH service is active, only ssh connection with a private key is allowed, no other connection is allowed, even with ssh+password. This feature, either integrated into Ubuntu, or is implemented by Digital Ocean, I guess the first.

Considering this, there is no problem that raised in this question; no one can connect to the server unless you have the private key, and if you also only allow the ssh connection from a specific IP, the security is very good.