「ssh config」の版間の差分

提供: セキュリティ
移動: 案内検索
(Daemon がページ「Ssh config」を「ssh config」に移動しました)
(相違点なし)

2013年3月29日 (金) 17:38時点における版


ssh_config は、 ssh コマンドの設定ファイルです。

読み方

ssh_config
えすえすえいち こんふぃぐ

目次

概要

ssh_config は、ssh コマンドの設定ファイルです。 サーバごとの個別の設定を行うことができ、コマンドラインオプションを省略できます。

sshd の設定ファイルは、 sshd_config です。

インストール

ホームディレクトリの ~/.ssh/ に config という設定ファイルを作成します。

FreeBSD

cp /etc/ssh_config ~/.ssh/config

設定の優先順位

設定は、以下の順序で読み込まれます。

  1. コマンドラインオプション
  2. ユーザ設定ファイル(~/.ssh/config)
  3. システム全体の設定ファイル(/etc/ssh/ssh_config)

設定ファイル

FreeBSD のデフォルト

以下は、FreeBSD の /etc/ssh/ssh_config です。

#       $OpenBSD: ssh_config,v 1.26 2010/01/11 01:39:46 dtucker Exp $
#       $FreeBSD: release/9.0.0/crypto/openssh/ssh_config 221420 2011-05-04 07:34:44Z des $
 
# This is the ssh client system-wide configuration file.  See
# ssh_config(5) for more information.  This file provides defaults for
# users, and the values can be changed in per-user configuration files
# or on the command line.
 
# Configuration data is parsed as follows:
#  1. command line options
#  2. user-specific file
#  3. system-wide file
# Any configuration value is only changed the first time it is set.
# Thus, host-specific definitions should be at the beginning of the
# configuration file, and defaults at the end.
 
# Site-wide defaults for some commonly used options.  For a comprehensive
# list of available options, their meanings and defaults, please see the
# ssh_config(5) man page.
 
# Host *
#   ForwardAgent no
#   ForwardX11 no
#   RhostsRSAAuthentication no
#   RSAAuthentication yes
#   PasswordAuthentication yes
#   HostbasedAuthentication no
#   GSSAPIAuthentication no
#   GSSAPIDelegateCredentials no
#   BatchMode no
#   CheckHostIP no
#   AddressFamily any
#   ConnectTimeout 0
#   StrictHostKeyChecking ask
#   IdentityFile ~/.ssh/identity
#   IdentityFile ~/.ssh/id_rsa
#   IdentityFile ~/.ssh/id_dsa
#   Port 22
#   Protocol 2,1
#   Cipher 3des
#   Ciphers aes128-ctr,aes192-ctr,aes256-ctr,arcfour256,arcfour128,aes128-cbc,3des-cbc
#   MACs hmac-md5,hmac-sha1,umac-64@openssh.com,hmac-ripemd160
#   EscapeChar ~
#   Tunnel no
#   TunnelDevice any:any
#   PermitLocalCommand no
#   VisualHostKey no
#   ProxyCommand ssh -q -W %h:%p gateway.example.com
#   VersionAddendum FreeBSD-20110503

設定

AddressFamily

接続時に使用するアドレスファミリを指定します。

any
すべて
inet
IPv4
inet6
IPv6
AddressFamily {any|inet|inet6}

BatchMode

BatchMode が yes の場合、パスフレーズパスワード の入力を求めません。スクリプトなどのバッチ処理実行時にパスワードを入力するユーザがいない場合に利用します。

デフォルトは、no 。

BatchMode {yes|no}

BindAddress

ローカルマシンで指定されたアドレスを接続時のソースアドレスとして利用します。 複数のIPアドレスをもっているマシンで利用します。

BindAddress

ChallengeResponseAuthentication

チャレンジレスポンス認証を行うか指定します。

ChallengeResponseAuthentication

CheckHostIP

CheckHostIP が yes の場合、接続先ホスト名のIPアドレスが known_hosts にないIPアドレスの警告をします。 DNS 詐欺によってホスト鍵が変更されたことを検出できます。

CheckHostIP {yes|no}

Cipher

ssh バージョン 1 で使う暗号を指定します。

Cipher

Ciphers

ssh バージョン 2 で使う暗号を指定します。

Ciphers

ClearAllForwardings

yes の場合、コマンドラインで指定されたローカル、リモート、ダイナミックなポート転送をすべてキャンセルします。 デフォルトは、no 。

ClearAllForwardings {yes|no}

Compression

yes の場合、データ圧縮を行います。

デフォルトは、no 。

Compression {yes|no}

CompressionLevel

データの圧縮レベルを指定します。圧縮レベルは、1-9の間の数字で指定します。

デフォルトは、 6 です。 

1
速い
9
遅い、高圧縮率
CompressionLevel {1-9}

ConnectionAttempts

ConnectionAttempts

ConnectTimeout

ConnectTimeout

ControlMaster

ControlMaster

ControlPath

ControlPath

DynamicForward

DynamicForward

EscapeChar

EscapeChar

ExitOnForwardFailure

ExitOnForwardFailure

ForwardAgent

サーバ側への認証エージェントの転送を許可するか指定します。

yes
エージェントを転送する
no
エージェントを転送しない
ForwardAgent {yes|no}

ForwardX11

ForwardX11

ForwardX11Trusted

ForwardX11Trusted

GatewayPorts

GatewayPorts

GlobalKnownHostsFile

GlobalKnownHostsFile

GSSAPIAuthentication

GSSAPIAuthentication

GSSAPIDelegateCredentials

GSSAPIDelegateCredentials

HashKnownHosts

HashKnownHosts

Host

「設定を適用するホスト」を指定します。? や * が利用できます。

Host A
	User		foo
	IdentityFile ~/.ssh/id_dsa_A
 
Host B
	User		bar
	IdentityFile ~/.ssh/id_dsa_B
 
Host C D E
	User		meta
	IdentityFile ~/.ssh/id_dsa_C
 
# 192.168.0.[0-9]
Host 192.168.0.?
	User	private
	IdentityFile ~/.ssh/id_rsa_P
 
Host *.xyz
	User		Host
	IdentityFile ~/.ssh/id_dsa_Z

HostbasedAuthentication

HostbasedAuthentication

HostKeyAlgorithms

HostKeyAlgorithms

HostKeyAlias

HostKeyAlias

HostName

HostName

IdentityFile

秘密鍵ファイルを設定します。 ssh バージョン 2 のデフォルトのパスは ~/.ssh/id_rsa もしくは ~/.ssh/id_dsa です。 ssh バージョン 1 のデフォルトのパスは ~/.ssh/identity です。

IdentityFile 秘密鍵ファイル

IdentitiesOnly

IdentitiesOnly

IPQoS

IPQoS

KbdInteractiveDevices

KbdInteractiveDevices

KexAlgorithms

KexAlgorithms

LocalCommand

PermitLocalCommand が yes の場合、サーバへログイン後にクライアント上で実行するコマンドを LocalCommand に指定します。

LocalCommand コマンド

LocalForward

LocalForward

LogLevel

LogLevel

MACs

MACs

NoHostAuthenticationForLocalhost

NoHostAuthenticationForLocalhost

NumberOfPasswordPrompts

NumberOfPasswordPrompts

PasswordAuthentication

パスワード認証を有効にするか設定します。 PasswordAuthentication が yes の場合、パスワード認証をおこないます。

PasswordAuthentication {yes|no}

PermitLocalCommand

PermitLocalCommand が yes の場合、サーバへログイン後にクライアントが LocalCommand で指定されたコマンドを実行します。

PermitLocalCommand

PKCS11Provider

PKCS11Provider

Port

Port

PreferredAuthentications

PreferredAuthentications

Protocol

Protocol

ProxyCommand

ProxyCommand

PubkeyAuthentication

SSH バージョン 2 を使用している場合、サーバとの認証時に 公開鍵認証 を試みるか指定します。

PubkeyAuthentication {yes|no}

RekeyLimit

RekeyLimit

RemoteForward

サーバのPortAに行われた TCP 接続をクライアント側ホストBのポートCに転送します。

RemoteForward ポートA ホストB:ポートC

RhostsRSAAuthentication

RhostsRSAAuthentication

RSAAuthentication

RSAAuthentication

SendEnv

SendEnv

ServerAliveInterval

ServerAliveInterval

ServerAliveCountMax

ServerAliveCountMax

StrictHostKeyChecking

StrictHostKeyChecking

TCPKeepAlive

TCPKeepAlive

Tunnel

Tunnel

TunnelDevice

TunnelDevice

UsePrivilegedPort

UsePrivilegedPort

User

ログインユーザを指定します。

User ユーザ名

UserKnownHostsFile

UserKnownHostsFile

VerifyHostKeyDNS

yes の場合、DNS と SSHFP リソースレコードを利用し、リモートホストの公開鍵を検証します。

デフォルトは、 no です。 

VerifyHostKeyDNS {yes|no}

VersionAddendum

VersionAddendum

VisualHostKey

yes の場合、ホスト鍵が未知のマシンにログインするとき、16進表示のリモートホストの鍵のフィンガープリントに加え、アスキーアート表現も表示します。

デフォルトは、 no です。 

VisualHostKey {yes|no}

XAuthLocation

xauth のプログラムのフルパスを指定します。

デフォルトは、 /usr/X11R6/bin/xauth です。

XAuthLocation コマンドのパス
% ls -i /usr/X11R6/bin/xauth  /usr/local/bin/xauth
1474312 /usr/X11R6/bin/xauth* 1474312 /usr/local/bin/xauth*

使い方

デフォルトの ssh の設定ファイルではない設定ファイルを利用する場合は、 -F オプションで設定ファイルのパスを指定します。

ssh -F ~/.ssh/config_test foo

関連項目