Posts tagged: ssh

Generating Public / Private keys

To generate a public / private key pair:

Assumes OpenSSL is available. You might choose to rename the files from the defaults provided.

cd ~/.ssh

For an RSA key. Default answers generally work well.

ssh-keygen -t rsa -b 1024

For an DSA key

ssh-keygen -t dsa

Make sure your ~/.ssh directory permissions are correct. SSH (and anything based on SSH) won’t function correctly or at all if these are not correct.

  1. rw-r–r– 1 sshuser staff 67 Jan 14 11:10 config
  2. rw——- 1 sshuser staff 668 Jan 14 11:08 id_dsa
  3. rw-r–r– 1 sshuser staff 617 Jan 14 11:08 id_dsa.pub
  4. rw——- 1 sshuser staff 883 Jan 14 11:07 id_rsa
  5. rw-r–r– 1 sshuser staff 237 Jan 14 11:07 id_rsa.pub
  6. rw-r–r– 1 sshuser staff 411 Jan 14 11:11 known_hosts

That’s it!

ssh command-line mode and shell startup files

Apparently, if you do

ssh me@there:somepath “some cmd”

and your account is set up with ‘bash’ as your shell, only ~/.bashrc gets executed as a shell startup command

Generate ssh keys

To generate ssh keys

  • Make sure ~/.ssh exists, and has permissions 700
  • cd ~/.ssh
  • ssh-keygen -t dsa
  • ssh-keygen -t rsa

SSH – Avoiding Timeouts

In your ./.ssh/config file

ConnectTimeout 0

Host *
ServerAliveInterval 120
ServerAliveCountMax 3

WordPress Themes