LoginSignup
6
10

More than 3 years have passed since last update.

[備忘録]~/.sshの作り方とconfigの設定

Last updated at Posted at 2020-03-13

目的

  • 人生で何度か設定するけどその都度調べて時間を浪費してしまうので、そうしないための備忘録。

必要な事

# 空ディレクトリ作成
$ mkdir ~/.ssh

# 空ファイル作成
$ touch ~/.ssh/config

# パーミッション変更
$ chmod 700 ~/.ssh
$ chmod 600 ~/.ssh/*

# configファイルの編集
$ vim ~/.ssh/config

Host *
    StrictHostKeyChecking no
    UserKnownHostsFile=/dev/null
    ServerAliveInterval 15
    ServerAliveCountMax 30
    AddKeysToAgent yes
    UseKeychain yes
    IdentitiesOnly yes
  • Host * 全ホストの共通設定
  • OpenSSHの警告メッセージを非表示
    • StrictHostKeyChecking no
    • UserKnownHostsFile=/dev/null
  • SSH接続のタイムアウト設定
    • ServerAliveInterval 15
    • ServerAliveCountMax 30
  • 入力したパスワード/鍵の省略設定
    • AddKeysToAgent yes
    • UseKeychain yes
  • 認証の際に、ssh_config ファイルで指定された秘密鍵のみを使用するよう指定

引用元:Mac Git 初期設定

6
10
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
6
10