接続元を制限する
/etc/hosts.allow、/etc/hosts.deny を編集することで簡単に
接続元を制限することができます。
/etc/hosts.allow
# # hosts.allow This file describes the names of the hosts which are # allowed to use the local INET services, as decided # by the '/usr/sbin/tcpd' server. # sshd: 192.168.0.
/etc/hosts.deny
# # hosts.deny This file describes the names of the hosts which are # *not* allowed to use the local INET services, as decided # by the '/usr/sbin/tcpd' server. # # The portmap line is redundant, but it is left to remind you that # the new secure portmap uses hosts.deny and hosts.allow. In particular # you should know that NFS uses portmap! sshd: ALL
上記は、hosts.deny で全てのホストからログインを拒否し、hosts.allow で192.168.0.xx
からのログインを許可している。
つまり、結果としては192.168.0.xx 以外からのログインは認めないという設定となる。