Diferències

Ací es mostren les diferències entre la revisió seleccionada i la versió actual de la pàgina.

Enllaç a la visualització de la comparació

Ambdós costats versió prèvia Revisió prèvia
Següent revisió
Revisió prèvia
linux:ssh:clientconfig [20/06/2018 16:40] – [ficheros configuración conexión] matelinux:ssh:clientconfig [21/11/2023 23:48] (actual) mate
Línia 1: Línia 1:
-configuración cliente+fichero .ssh/config 
 +[[https://linux.die.net/man/5/ssh_config|man page]]
 == fichero configuración conexión  == fichero configuración conexión 
 para simplificar la conexión vía SSH con diferentes servidores, y en alternativa a crear ''alias'' de conexiones: para simplificar la conexión vía SSH con diferentes servidores, y en alternativa a crear ''alias'' de conexiones:
 <code bash>alias ssh-local-dns='ssh -v -i /home/mate/.ssh/pi@raspberry pi@192.168.1.60'</code> <code bash>alias ssh-local-dns='ssh -v -i /home/mate/.ssh/pi@raspberry pi@192.168.1.60'</code>
 se puede optar por crear el fichero de configuración de conexión (''~/.ssh/config'') e invocarlo:<code bash>ssh nombre_host</code> se puede optar por crear el fichero de configuración de conexión (''~/.ssh/config'') e invocarlo:<code bash>ssh nombre_host</code>
 +
 +== nociones básicas
 +  * uso de ''Include <FILE>'' para fraccionar el fichero en otros
 +  * uso de ''Host *'' o ''Host *.dominio.com'' o ''Host 192.168.10.?'' para establecer opciones comunes a varios servidores.<code>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"</code>
 +  * opciones interesantes:
 +    * ''IdentitiesOnly=yes'' # only use the authentication identity files configured in the ssh_config files
 +    * ''PreferredAuthentications=publickey'' # Specifies the order in which the client should try protocol 2 authentication methods."gssapi-with-mic, hostbased, publickey, keyboard-interactive, password"
 +    * ''AddressFamily inet'' # any, inet (IPv4), inet6 (IPv6)
 +    * ''Protocol 2'' 
 +    * ''Compression yes''
 +    * ''ServerAliveInterval 60''
 +    * ''ServerAliveCountMax 20''
 +    * ''LogLevel INFO''
  
 == estructura ficheros == estructura ficheros
Línia 14: Línia 33:
 </sxh> </sxh>
  
-definir diferentes tipos de conexión según un proyecto o empresa +=== repositorios git 
-<sxh bash>+<sxh bash; title: uso en repositorios>
 Host github.com Host github.com
-    User fooey+    User git
     HostName github.com     HostName github.com
     IdentityFile ~/.ssh/my.key     IdentityFile ~/.ssh/my.key
-     
-Host github-org 
-    User fooey 
-    Hostname github.com 
-    IdentityFile ~/.ssh/myother.key 
 </sxh> </sxh>
-<code bash>git clone fooey@github-org:orgname/repository.git</code>+<code bash>git clone git@github.com:orgname/repository.git</code> 
 + 
 +=== mismo repositorios git, varios usuarios  
 +<sxh bash; title:uso de diferentes claves para mismo origen> 
 +#user1 account 
 + Host bitbucket.org-user1 
 +     HostName bitbucket.org 
 +     User git 
 +     IdentityFile ~/.ssh/user1 
 +     IdentitiesOnly yes 
 + 
 + #user2 account 
 + Host bitbucket.org-user2 
 +     HostName bitbucket.org 
 +     User git 
 +     IdentityFile ~/.ssh/user2 
 +     IdentitiesOnly yes 
 +</sxh> 
 +Si se quiere automatizar el pull/push con diferentes cuentas se debe: 
 +  * crear esa configuración en el fichero ''~/.ssh/config'' 
 +  * modificar el user/email del proyecto en cuestión 
 +    * ''git config user.name "user1"'' 
 +    * ''git config user.email "user1@example.com"'' 
 +  * modificar el upstream del proyecto 
 +    * ''git remote set-url origin git@bitbucket.org-user1:user1/your-repo-name.git'' 
 +  * o usar la cadena correcta al clonar/importar: 
 +    * ''git clone git@bitbucket.org-user1:user1/your-repo-name.git'' 
 + 
 +/via: [[https://developer.atlassian.com/blog/2016/04/different-ssh-keys-multiple-bitbucket-accounts/]]
  
-conexiones haciendo tunneling+=== tunneling
 <sxh bash> <sxh bash>
 Host tunnel Host tunnel
Línia 49: Línia 91:
       * variables de entorno que se pueden pasar       * variables de entorno que se pueden pasar
       * uso de wildcards para los hosts       * uso de wildcards para los hosts
 +  * [[https://www.ssh.com/ssh/config/]]
  • linux/ssh/clientconfig.1529538028.txt.gz
  • Darrera modificació: 20/06/2018 16:40
  • per mate