SSH
SSH
一括して PermitRootLogin no
など
cat /etc/ssh/sshd_config | grep 'Include'
Include /etc/ssh/sshd_config.d/*.conf
sudo tee /etc/ssh/sshd_config.d/99-custom.conf << EOF
PermitRootLogin no
PubkeyAuthentication yes
PasswordAuthentication no
PermitEmptyPasswords no
EOF
sudo systemctl restart sshd
PasswordAuthentication no
の動作確認
ssh -o PreferredAuthentications=password <target>
port forward 利用時の connection refused メッセージを表示させない
-q
オプションを利用する
ssh host.example -L '9090:127.0.0.1:9090` -q
エラーの例
ssh -L '9090:127.0.0.1:9090'
のようにポートフォワードを利用しているときに、リモート側でそのポートが待ち受けていないと、手元側で以下のようなメッセージが出力される
channel 7: open failed: connect failed: Connection refused
known_hosts から特定のホストを削除
ssh-keygen -R 192.0.2.1
ssh-keygen -R host.example
FreeBSD で PasswordAuthentication no にしても keyboard-interactive が残る
- 以下の設定が必要
- 環境
- FreeBSD 14.0-RELEASE-p3
- OpenSSH_9.5p1, OpenSSL 3.0.12 24 Oct 2023
# keyboard-interactive disable
ChallengeResponseAuthentication no
ssh-keygen
-f ./id_ed25519
でファイル名を指定-C ""
でコメントにホスト名を含めない
ssh-keygen -t ed25519 -f ./id_ed25519 -C ""
最終更新日