LoginSignup
7
6

More than 5 years have passed since last update.

特定のIPからのみSSH接続を許可

Posted at

前にOpenVPNを構築して開発環境を作成したが、

SSH接続をOpenVPN経由でのみ許可したかったためその方法を紹介します。

1. /etc/hosts.denyに追加

初めに拒否リストを編集してすべての接続を拒否する

vi /etc/hosts.deny

#すべての接続を拒否
sshd : ALL

2. 許可するIPを/etc/hosts.allowに追加

次に許可したいIPをここに追加

vi /etc/hosts.allow

#接続を許可したいIPを追記
sshd: 10.8.
sshd: 127.0.0.1

これで/etc/hosts.allowに追加したIPからのみSSH接続ができるようになりました。

7
6
1

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
7
6