by Devin Yang
(This article was automatically translated.)

Published - 5 years ago ( Updated - 5 years ago )

When we use ssh public key authentication, we usually add relevant settings in ~/.ssh/config.
If some are used by the company or at home, can multiple configs be used?
In fact, it is possible. We can use git to load the company-shared, version-controlled config through Include.

The following is a schematic setting of ~/.ssh/config.
Include ~/.ssh/keys/office_config

#Ha Backup
Host habackup
Hostname 172.16.1.10
User git
StrictHostKeyChecking no
IdentityFile=~/.ssh/id_rsa

#gogs
Host gogs
Hostname 172.16.1.13
User git
Keep Alive yes
ServerAliveInterval 30
StrictHostKeyChecking no
IdentityFile=~/.ssh/id_rsa
Port 10022

Host cc
Hostname 192.168.100.1
User root
IdentityFile=~/.ssh/id_rsa
Port 2222

Host ccc
Hostname 35.194.181.21
User devin_yang
IdentityFile=~/.ssh/ccc-gcp

#GitLab
Host gitlab.com
Hostname gitlab.com
User git
IdentityFile=~/.ssh/id_rsa_gitlab

Tags: linux

Devin Yang

Feel free to ask me, if you don't get it.:)

No Comment

Post your comment

Login is required to leave comments

Similar Stories


linux, cli

How to use the find command to find files that have been changed within 7 days

If we have changed some files, how to find out through the command line?

linux

How to check apache loaded and enabled which modules?

How to check apache loaded and enabled which modules?

linux,system

Detect whether selinux is enabled in the system

Detect whether selinux is enabled in the system