3
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

`.ssh/config` の Host はワイルドカードで書ける

Posted at

開発、ステージング、本番など共通の設定があるならば「*」で一括指定できる。

Host foobar-web-1
    Host 192.168.0.1
Host foobar-web-2
    Host 192.168.0.2
Host foobar-db
    Host 192.168.0.3
Host foobar-dev
    Host 192.168.0.4
Host foobar-staging
    Host 192.168.0.5

Host foobar-web*
    # WEB のみ 鍵が違う
    IdentityFile ~/.ssh/id_rsa-foobar-web

# 最初に見つかったものが使われるので、デフォルトは下に書く
Host foobar*
    # 全てのホストで、User は hoge
    User hoge
    IdentityFile ~/.ssh/id_rsa-foobar
3
4
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
3
4

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?