SSH / SSHD

Secure Shell (SSH) is a cryptographic network protocol for operating network services securely over an unsecured network.

References

Key-pairs

Generating a key

ssh-keygen -t rsa -b 4096 -f $KEY_FILE

Changing a key passphrase

ssh-keygen -f $KEY_FILE -p

SSH client config

nano ~/.ssh/config
Host <ALIAS OR HOSTNAME>
  User <USERNAME>
  Port <PORT>
  IdentityFile <FILENAME>
  IdentitiesOnly yes
  LocalForward 3306 127.0.0.1:3306

SSH with GIT

You can configure multiple git identities with your ssh config file

Host github-user1
  User git
  Hostname github.com
  IdentityFile /Volumes/KEYS/github-user1-id_rsa
  IdentitiesOnly yes
git remote add origin github-user1:$ORG/$REPO

Bueller, Bueller, …

Always use IdentitiesOnly yes when configuring an ssh git repository

If the IdentityFile given fails, and there is another key in memory that works with the service (I.E. multiple GitHub accounts), you may end up uploading content as the wrong identity.

SSHD server config

A fast way to debug SSHD servers is to stop the system daemon, and restart it interactively with the debug flag. Backend causes of client connections failures may be easier to diagnose.

/etc/init.d/sshd stop
/usr/sbin/sshd -Dd