ก่อนหน้านี้เราได้รู้วิธีการสร้าง ssh key และใช้ key เพื่อ remote ไปที่ server ตาม link ด้านล่าง ต่อไปถ้าเราต้องการ remote ไปที่ server หลายตัวมี key หลายอัน เราสามารถเพิ่มความสะดวกโดยการสร้าง ssh config เพื่อง่ายในการ remote ดังนี้
สร้าง config file ขึ้นมาก่อน
touch ~/.ssh/config
รูปแบบของการ map จะเป็นดังนี้
Host firsthost
SSH_OPTION_1 custom_value
SSH_OPTION_2 custom_value
SSH_OPTION_3 custom_value
Host secondhost
ANOTHER_OPTION custom_value
ตัวอย่างใน config
Host home
HostName example.com
User apollo
Port 4567
IdentityFile ~/.ssh/id_rsa
จากปกติเรา remote แบบนี้
ssh -i ~/.ssh/id_rsa apollo@example.com -p 4567
จะเปลี่ยนเป็น
ssh home
จากตัวอย่างจะเห็นได้ว่า เราสามารถ remote ไปที่ server ต่างๆได้สะดวกขึ้น