Taula de continguts

fichero .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:

alias ssh-local-dns='ssh -v -i /home/mate/.ssh/pi@raspberry pi@192.168.1.60'

se puede optar por crear el fichero de configuración de conexión (~/.ssh/config) e invocarlo:

ssh nombre_host

nociones básicas

estructura ficheros

dentro del fichero ~/.ssh/config

Host dev
    HostName dev.example.com
    Port 22000
    User fooey

repositorios git

Host github.com
    User git
    HostName github.com
    IdentityFile ~/.ssh/my.key

git clone git@github.com:orgname/repository.git

mismo repositorios git, varios usuarios

#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
Si se quiere automatizar el pull/push con diferentes cuentas se debe:

/via: https://developer.atlassian.com/blog/2016/04/different-ssh-keys-multiple-bitbucket-accounts/

tunneling

Host tunnel
    HostName database.example.com
    IdentityFile ~/.ssh/other.key
    LocalForward 9906 127.0.0.1:3306
    User fooey
equivaldría a:

ssh -f -N -L 9906:127.0.0.1:3306 fooey@database.example.com

y se ejecutaría:

ssh -f -N tunnel

enlaces