0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

ssh設定変更

0
Posted at

不正アクセス対策

1日のアクセスログチェック
$cat /var/log/secure | grep "Received disconnect" | wc -l
としたところ3767件のアクセスを確認。
ユーザ名,portはroot,22に限らずランダムな模様。

ひとまずrootアクセスを不可に。
$ vi /etc/ssh/sshd_config
PermitRootLogin yes →PermitRootLogin no

  • sshのポートを変更
    sshのサービスファイルからポート番号変更
    /usr*のファイルを直接変更せず/etcに編集ファイルをコピー
    $cp /usr/lib/firewalld/services/ssh.xml /etc/firewalld/services/ssh.xml

ファイアーウォール更新
$ firewall-cmd --reload

sshdのポート設定変更
$ vi /etc/ssh/sshd_config
#Port22

Port1234
$ systemctl restart sshd

これで不正アクセスは大幅に減ったと思われる
ーーーーーーーーーーーーーーーーー

  • ※macのターミナルがよく固まるのでmac側で対策
    ---- vi追記 ----
    Host *
    ServerAliveInterval 15
0
0
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
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?