GNU/Linux >> Znalost Linux >  >> Linux

Ssh – více podobných položek v konfiguraci Ssh?

Řekněme, že chci nakonfigurovat ssh možnosti pro 30 serverů se stejným nastavením v mém .ssh config soubor:

host XXX
     HostName XXX.YYY.com
     User my_username
     Compression yes
     Ciphers arcfour,blowfish-cbc
     Protocol 2
     ControlMaster auto
     ControlPath ~/.ssh/%[email protected]%h:%p
     IdentityFile ~/.ssh/YYY/id_rsa

kde jediná věc, která se mezi těmito 30 stroji mění, je XXX .

Místo toho, abych 30krát opakoval výše uvedenou strukturu v mém config existuje jiný způsob, jak definovat rozsah počítačů?

Přijatá odpověď:

Z ssh_config(5) manuálová stránka:

 Host    Restricts the following declarations (up to the next Host key‐
         word) 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.

 HostName
         Specifies the real host name to log into.  This can be used to
         specify nicknames or abbreviations for hosts.  If the hostname
         contains the character sequence ‘%h’, then this will be replaced
         with the host name specified on the commandline (this is useful
         for manipulating unqualified names).

Takže:

Host XXX1 XXX2 XXX3
  HostName %h.YYY.com

Linux
  1. Jak zadat heslo pro více Windows?

  2. Ssh na více hostitelů a spustit příkaz?

  3. Jak používat stejný alias Ssh s více hostitelskými adresami/porty/atd.?

  1. Více knihoven glibc na jednom hostiteli

  2. Soubory Rsync přes zprostředkujícího hostitele

  3. SSH - Jak zahrnout příkaz -t do souboru ~/.ssh/config

  1. Ssh – Omezení uživatele Ssh/scp/sftp na adresář?

  2. přidání hesla do .ssh/config

  3. Jak SSH přímo na cíl přes jumphost pomocí SSH Config bez dalšího příkazu ssh