by Devin Yang
(This article was automatically translated.)

Published - 6 years ago ( Updated - 6 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,mac

Password Generator on MacOS or Linux

Sometimes we need to generate a random password, but do not know what to use? Here is a simple bash that allows us to easily generate a set of passwords on the terminal.

linux,security

ssh-agent and ssh-add authentication agent

Programs in the ssh core suite such as scp, ssh, ssh-add, ssh-agent, sshd, and ssh-keygen Let's talk about ssh-agent and ssh-add usage scenarios. Before we start, let's take a brief introduction to the purpose of these instructions:

linux

Remove the Linux Kernel that is not used by the old version on Ubuntu

This page describes how I removed the old version of Linux Kernel taking up space on ubuntu.