Mostra la pàginaRevisions anteriorsQuè hi enllaçaExporta a PDFTorna dalt Aquesta pàgina és només de lectura. Podeu veure'n el codi font, però no podeu canviar-la. Consulteu el vostre administrador si penseu que això és degut a algun error. = fichero .ssh/config [[https://linux.die.net/man/5/ssh_config|man page]] == fichero configuración conexión 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> 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 dentro del fichero ''~/.ssh/config'' <sxh bash> Host dev HostName dev.example.com Port 22000 User fooey </sxh> === repositorios git <sxh bash; title: uso en repositorios> Host github.com User git HostName github.com IdentityFile ~/.ssh/my.key </sxh> <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/]] === tunneling <sxh bash> Host tunnel HostName database.example.com IdentityFile ~/.ssh/other.key LocalForward 9906 127.0.0.1:3306 User fooey </sxh> equivaldría a: <code bash>ssh -f -N -L 9906:127.0.0.1:3306 fooey@database.example.com</code> y se ejecutaría: <code bash>ssh -f -N tunnel</code> == enlaces * info de este tutorial: [[https://nerderati.com/2011/03/17/simplify-your-life-with-an-ssh-config-file/]] * [[https://linux.die.net/man/5/ssh_config]] * según el tutorial, se pueden hacer muchas combinaciones, por ejemplo: * cambiar el número de conexiones * establecer el nivel de log mostrado * variables de entorno que se pueden pasar * uso de wildcards para los hosts * [[https://www.ssh.com/ssh/config/]] linux/ssh/clientconfig.txt Darrera modificació: 21/11/2023 23:48per mate