ユーザ用ツール

サイト用ツール


serverapps:security:ssh

差分

このページの2つのバージョン間の差分を表示します。

この比較画面にリンクする

両方とも前のリビジョン 前のリビジョン
次のリビジョン
前のリビジョン
serverapps:security:ssh [2023/11/01 16:12]
hayashi
serverapps:security:ssh [2024/02/02 12:28] (現在)
hayashi [パスワードログインを禁止]
行 18: 行 18:
  
 ===== ssh-agent ===== ===== ssh-agent =====
 +通常は.bashrcなどに記述するが、tcshなども利用しているので以下のスクリプトを作成
 <code> <code>
 +#!/bin/sh
 # for ssh-agent # for ssh-agent
 +cd ~
 if [ -f ~/.ssh-agent ]; then if [ -f ~/.ssh-agent ]; then
     . ~/.ssh-agent     . ~/.ssh-agent
 fi fi
 if [ -z "$SSH_AGENT_PID" ] || ! kill -0 $SSH_AGENT_PID; then if [ -z "$SSH_AGENT_PID" ] || ! kill -0 $SSH_AGENT_PID; then
-    ssh-agent > ~/.ssh-agent+    /usr/bin/ssh-agent -s > ~/.ssh-agent
     . ~/.ssh-agent     . ~/.ssh-agent
 fi fi
-ssh-add -l >/dev/null || ssh-add+ssh-add -l > /dev/null 2>&|| ssh-add
 </code> </code>
  
行 83: 行 86:
   PasswordAuthentication no   PasswordAuthentication no
   ChallengeResponseAuthentication no   ChallengeResponseAuthentication no
-  UsePAM no+
  
 FreeBSDは標準でPasswordAuthentication を禁止しているがChallengeResponseAuthentication は許可されているのでこちらも必ず「No」にしておく。 FreeBSDは標準でPasswordAuthentication を禁止しているがChallengeResponseAuthentication は許可されているのでこちらも必ず「No」にしておく。
 +
 +Ubuntuで「/etc/ssh/sshd_config.d/50-cloud-init.conf」に以下の設定があったためこちらも禁止にする
 +
 +<file /etc/ssh/sshd_config.d/50-cloud-init.conf>
 +#PasswordAuthentication yes
 +PasswordAuthentication no
 +</file>
 ==== 公開鍵認証をON ==== ==== 公開鍵認証をON ====
  
serverapps/security/ssh.1698822749.txt.gz · 最終更新: 2023/11/01 16:12 by hayashi