メインコンテンツへスキップ
見出し画像

RHEL8のSSH設定

    備忘録。RHEL8でsshするときのポート開放設定手順。

    /etc/ssh/sshd_config

    Port [Port No.]
    PermitRootLogin no
    PasswordAuthentication no

    SELinuxの状態確認

    $getenforce
    Enforcing

    EnforcingとなっているときはSELinuxが有効

    SELinuxが許可しているポートを確認,追加

    # semanage port --list | grep ssh
    # semanage port --add --type ssh_port_t --proto tcp 20022

    20022は任意の未使用ポート番号

    firewallで許可されているサービスの確認

    firewall-cmd --list-services --zone=public --permanent

    firewallで許可されているサービスのポート変更

    cp /usr/lib/firewalld/services/ssh.xml /etc/firewalld/services/

    /etc/firewalld/servicesのポートの記述を編集

    firewall-cmd --reload

    CentOS8, CentOS7でも同様


    あなたへのおすすめ