whsicg
Last Updated: February 25, 2016
·
610
· sadfuzzy

Useful ssh config

Contents of useful ~/.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

Login without password input:

  • Generate ssh-keys:

    $ ssh-keygen
  • Copy your ~/.ssh/idrsa.pub -> ~/.ssh/authorizedkeys:

    $ ssh-copy-id developer@example.com

Or

$ < ~/.ssh/id_rsa.pub ssh mail 'mkdir -p .ssh; cat >> .ssh/authorized_keys; chmod go-w .ssh .ssh/authorized_keys'
  • Now you can:

    $ ssh www1
    $ ssh db

Original

Filed Under