ポート番号の変更、rootログインの禁止、パスワード認証の禁止(公開鍵認証のみ)、sftp通信時のパーミッション変更を設定します。
1.設定ファイルの内容を以下のように編集します
[root@sv1 ~]# vi /etc/ssh/sshd_config
+ Port 50022
- PermitRootLogin yes
+ PermitRootLogin no
- PasswordAuthentication yes
+ PasswordAuthentication no
- Subsystem sftp /usr/libexec/openssh/sftp-server
+ Subsystem sftp /usr/libexec/openssh/sftp-server -u 022
2.変更した設定を反映されるため、sshdを再起動します
[root@sv1 ~]# systemctl restart sshd
最後に変更したポート番号で接続できるかどうか確認しましょう。(変更確認まで、既存のsshコネクションは切断しないように)