18
18

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をファイル分割管理するようにした

Posted at

他の投稿をちらほら見かけますが、自分もやってみた。

~/.bashrc
sshconfig() {
        mv ~/.ssh/config{,.bak}
        cat ~/.ssh/conf.d/*.conf > ~/.ssh/config
}
sshconfig

と打てば.ssh/configが.ssh/conf.d/*.confを結合し生成します。

使用例

この際、ファイル名を連番にすることで結合の順番を決められます。

  • ~/.ssh/conf.d/01-config.conf
  • ~/.ssh/conf.d/02-service1.conf
  • ~/.ssh/conf.d/03-office.conf
  • ~/.ssh/conf.d/04-home.conf
  • ~/.ssh/conf.d/05-global2.conf

というファイルがある場合、上から順番に結合されます。

18
18
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
18
18

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?