linux:openssh
文書の過去の版を表示しています。
OpenSSHの設定
22番ポート以外で接続を待ち受ける
/etc/ssh/sshd_configを開き、Portに対して設定したいポート番号を指定する。 複数ポートで待ち受けたい場合は待ち受けたいポートの分だけ記載する。
# $OpenBSD: sshd_config,v 1.103 2018/04/09 20:41:22 tj Exp $ # This is the sshd server system-wide configuration file. See # sshd_config(5) for more information. # This sshd was compiled with PATH=/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin # The strategy used for options in the default sshd_config shipped with # OpenSSH is to specify options with their default value where # possible, but leave them commented. Uncommented options override the # default value. # If you want to change the port on a SELinux system, you have to tell # SELinux about this change. # semanage port -a -t ssh_port_t -p tcp #PORTNUMBER # Port 10022 #AddressFamily any #ListenAddress 0.0.0.0 #ListenAddress ::
編集が完了したら、ファイアウォールでポートを開放する。ファイアウォールを設定していない場合はこの手順は不要。
firewall-cmd --permanent --add-port 10022/tcp
sshdサービスを再読み込みまたは再起動する。現在のセッションを残す場合は再読み込みして別セッションで接続が確立できることを確認できるのでより安全。
systemctl reload sshd
linux/openssh.1761657336.txt.gz · 最終更新: 2025/10/28 22:15 by mikoto