Configuração ssh útil

Conteúdo útil de ~ / .ssh / config:

# Set this to share connection between terminals
ControlMaster auto
ControlPath /tmp/ssh_mux_%h_%p_%r
# Time to hold connection
ControlPersist 6h
Host www* mail db
# Hostname to ssh in
HostName %h.example.com
# Username to login with
User developer
Port 22111
RemoteForward 8080 127.0.0.1:8080

Login sem entrada de senha:

  • Gerar ssh-keys:

    $ ssh-keygen
  • Copie suas chaves ~ / .ssh / id rsa.pub -> ~ / .ssh / autorizadas :

    $ ssh-copy-id developer@example.com

Ou

$ < ~/.ssh/id_rsa.pub ssh mail 'mkdir -p .ssh; cat >> .ssh/authorized_keys; chmod go-w .ssh .ssh/authorized_keys'
  • Agora você pode:

    $ ssh www1
    $ ssh db

Original