จากssh_configหน้าคน:
  สำหรับแต่ละพารามิเตอร์จะได้รับค่าแรกที่ได้รับ ไฟล์การกำหนดค่าประกอบด้วยส่วนที่คั่นด้วยข้อมูลจำเพาะ“ โฮสต์” และส่วนนั้นจะใช้กับโฮสต์ที่ตรงกับหนึ่งในรูปแบบที่กำหนดในข้อกำหนด ชื่อโฮสต์ที่ตรงกันคือชื่อที่ให้ในบรรทัดคำสั่ง
  
  เนื่องจากใช้ค่าที่ได้รับครั้งแรกสำหรับแต่ละพารามิเตอร์จึงควรกำหนดค่าการประกาศเฉพาะโฮสต์เพิ่มเติมใกล้จุดเริ่มต้นของไฟล์และค่าเริ่มต้นทั่วไปในตอนท้าย
นอกจากนี้ฉันต้องแน่ใจว่าฉันเข้าใจ 2 ส่วนเหล่านี้หากคุณไม่ชัดเจนว่าโฮสต์และรูปแบบการทำงานเป็นอย่างไร การจับคู่เกิดขึ้นเพียง 1 ระดับเท่านั้น สถานที่นี้เป็นพื้นฐานในความสามารถของ regex แต่ยังคงมีประสิทธิภาพเมื่อคุณค้นหา
ส่วนโฮสต์
 The possible keywords and their meanings are as follows (note that keywords 
 are case-insensitive and arguments are case-sensitive):
 Host    Restricts the following declarations (up to the next Host keyword) 
         to be only for those hosts that match one of the patterns given
         after the keyword.  If more than one pattern is provided, they 
         should be separated by whitespace.  A single ‘*’ as a pattern can 
         be used to provide global defaults for all hosts.  The host is the 
         hostname argument given on the command line (i.e. the name is not
         converted to a canonicalized host name before matching).
         A pattern entry may be negated by prefixing it with an exclamation 
         mark (‘!’).  If a negated entry is matched, then the Host entry is      
         ignored, regardless of whether any other patterns on the line 
         match.  Negated matches are therefore useful to provide exceptions 
         for wildcard matches.
         See PATTERNS for more information on patterns.
รูปแบบ
 A pattern consists of zero or more non-whitespace characters, ‘*’ (a 
 wildcard that matches zero or more characters), or ‘?’ (a wildcard that
 matches exactly one character).  For example, to specify a set of 
 declarations for any host in the “.co.uk” set of domains, the following
 pattern could be used:
       Host *.co.uk
 The following pattern would match any host in the 192.168.0.[0-9] network 
 range:
       Host 192.168.0.?
 A pattern-list is a comma-separated list of patterns.  Patterns within 
 pattern-lists may be negated by preceding them with an exclamation
 mark (‘!’).  For example, to allow a key to be used from anywhere within an 
 organisation except from the “dialup” pool, the following entry
 (in authorized_keys) could be used:
       from="!*.dialup.example.com,*.example.com"
กฎการเลเยอร์
ปัญหาเกี่ยวกับวิธีการของคุณคือรูปแบบที่ตรงกับส่วนโฮสต์ที่ 1 ไม่ตรงกับส่วนที่ 2 ฉันมักจะทำสิ่งนี้:
Host *
 User myuser
 IdentityFile ~/.ssh/myidentity
Host blah
 HostName complicated.hostname.com
สิ่งหนึ่งที่ผู้คนมักจะไม่ทำตามกฎเหล่านี้คือพวกเขาสามารถทำซ้ำได้ ดังนั้นสิ่งที่ฉันบ่อยครั้งทำคือมีหลายส่วนและฉันทำลายพวกเขาใช้Host *'s
Host *
 User user1
Host blah1
 HostName complicated1.hostname.com
Host blah2
 HostName complicated2.hostname.com
Host *
 User user2