将特定用户的SSHlogin限制为特定的IP地址

我想将特定的FreeBSD用户帐号的SSHlogin名限制在一个特定的IP地址(他们是从一台机器到另一台机器的自动rsync备份,实际用户不应该永远不会login,只需要SSH + rsync进程)。

我觉得我应该能够使用hosts.allow或sshd_config做到这一点…但我找不到任何明确的例子,如何做到这一点。 谁能告诉我?

除了包装选项….我想这个rsync备份正在使用ssh密钥。 您可以将密钥限制为特定的源IP或域。 这相当于用户到IP的限制,因为只有该用户正在使用该密钥(如果你的智能,你出现的)。

authorized_keys文件的第一行:

from =“trusted.domain.com”,no-port-forwarding,no-pty ssh-rsa AAAABasdf

从hosts.allow手册页:

CLIENT USERNAME LOOKUP When the client host supports the RFC 931 protocol or one of its descendants (TAP, IDENT, RFC 1413) the wrapper programs can retrieve additional information about the owner of a connection. Client user- name information, when available, is logged together with the client host name, and can be used to match patterns like: daemon_list : ... user_pattern@host_pattern ...