Fedora35でSSHを許可する方法

環境
OSバージョンを確認します
# cat /etc/redhat-release
Fedora release 35 (Thirty Five)

SSHを許可する方法
1.SSHのインストール状況を確認します

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
# yum list installed | grep ssh
NetworkManager-ssh.x86_64 1.2.12-2.fc35 @fedora
NetworkManager-ssh-gnome.x86_64 1.2.12-2.fc35 @fedora
libssh.x86_64 0.9.6-1.fc35 @anaconda
libssh-config.noarch 0.9.6-1.fc35 @anaconda
openssh.x86_64 8.7p1-2.fc35 @anaconda
openssh-clients.x86_64 8.7p1-2.fc35 @anaconda
openssh-server.x86_64 8.7p1-2.fc35 @anaconda
sshpass.x86_64 1.09-2.fc35 @fedora
# yum list installed | grep ssh NetworkManager-ssh.x86_64 1.2.12-2.fc35 @fedora NetworkManager-ssh-gnome.x86_64 1.2.12-2.fc35 @fedora libssh.x86_64 0.9.6-1.fc35 @anaconda libssh-config.noarch 0.9.6-1.fc35 @anaconda openssh.x86_64 8.7p1-2.fc35 @anaconda openssh-clients.x86_64 8.7p1-2.fc35 @anaconda openssh-server.x86_64 8.7p1-2.fc35 @anaconda sshpass.x86_64 1.09-2.fc35 @fedora
# yum list installed | grep ssh
NetworkManager-ssh.x86_64                   1.2.12-2.fc35                       @fedora
NetworkManager-ssh-gnome.x86_64             1.2.12-2.fc35                       @fedora
libssh.x86_64                               0.9.6-1.fc35                        @anaconda
libssh-config.noarch                        0.9.6-1.fc35                        @anaconda
openssh.x86_64                              8.7p1-2.fc35                        @anaconda
openssh-clients.x86_64                      8.7p1-2.fc35                        @anaconda
openssh-server.x86_64                       8.7p1-2.fc35                        @anaconda
sshpass.x86_64                              1.09-2.fc35                         @fedora

2.SSHを許可する設定を追加します
# vi /etc/ssh/sshd_config
下記内容を修正します
21行目
Port 22
40行目
PermitRootLogin yes
56行目
PasswordAuthentication yes

3.SSHを再起動します

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
# systemctl restart sshd
SSHの起動状況を確認します
# systemctl status sshd
● sshd.service - OpenSSH server daemon
Loaded: loaded (/usr/lib/systemd/system/sshd.service; enabled; vendor preset: enabled)
Active: active (running) since Tue 2022-05-17 23:36:05 JST; 35s ago
# systemctl restart sshd SSHの起動状況を確認します # systemctl status sshd ● sshd.service - OpenSSH server daemon Loaded: loaded (/usr/lib/systemd/system/sshd.service; enabled; vendor preset: enabled) Active: active (running) since Tue 2022-05-17 23:36:05 JST; 35s ago
# systemctl restart sshd
SSHの起動状況を確認します
# systemctl status sshd
● sshd.service - OpenSSH server daemon
     Loaded: loaded (/usr/lib/systemd/system/sshd.service; enabled; vendor preset: enabled)
     Active: active (running) since Tue 2022-05-17 23:36:05 JST; 35s ago

4.FirewallのSSHポートを設定します

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
# firewall-cmd --permanent --add-service=ssh
success
# firewall-cmd --permanent --add-service=ssh success
# firewall-cmd --permanent --add-service=ssh
success

SSHポートの開放状況を確認します

Plain text
Copy to clipboard
Open code in new window
EnlighterJS 3 Syntax Highlighter
# firewall-cmd --list-all
FedoraServer (active)
target: default
icmp-block-inversion: no
interfaces: ens33
sources:
services: cockpit dhcpv6-client ssh
# firewall-cmd --list-all FedoraServer (active) target: default icmp-block-inversion: no interfaces: ens33 sources: services: cockpit dhcpv6-client ssh
#  firewall-cmd --list-all
FedoraServer (active)
  target: default
  icmp-block-inversion: no
  interfaces: ens33
  sources:
  services: cockpit dhcpv6-client ssh

 

Fedora 35

Posted by arkgame