LoginSignup
9
3

More than 5 years have passed since last update.

sshの設定とログ確認

Posted at

ポート変更

$ vi /etc/ssh/sshd_config

#Port 22
Port 10022

$ vi /etc/sysconfig/iptables
-A INPUT -m state --state NEW -m tcp -p tcp --dport 10022 -j ACCEPT

$ service sshd restart
$ service iptables restart

ssh接続を新しいターミナルウィンドウを複製して接続を確認する。その後ファイアウォールの22番を閉じてサービス再起動

$ vi /etc/sysconfig/iptables

#コメントアウト
#-A INPUT -m state --state NEW -m tcp -p tcp --dport 22  -j ACCEPT

$ service iptables restart

ログ確認 sshのログインに失敗/成功したユーザ数

# grep -c invalid /var/log/secure
# grep -c Failed /var/log/secure
# grep -c Accepted /var/log/secure
9
3
0

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
9
3