Ssh authentication setup

From Genecats
Revision as of 19:51, 30 January 2017 by Galt (talk | contribs)
Jump to navigationJump to search

Auto-Login setup:

On hgwdev

ssh-keygen -t rsa  # (use enter for all defaults)
cd ~/.ssh,
cp id_dsa.pub authorized_keys
cd ..

Also put these in your local cse box or laptop (i.e. screech, pfft, whatever) (your-local-box:~/.ssh)

scp -r .ssh/ your-local-box:

The .ssh/ stuff should start out identical on the two machines.

Note that permissions on .ssh should be 700 and permissions on files in .ssh/ should be 600 (or you will have a message warning).

Steps to add to qateam@hgwdev

  1. Show your authorized_keys (cat authorized_keys, this looks like ssh-dss .......encryption.... == user@hgwdev)
  2. In a new terminal ssh to qateam and cd to the .ssh directory (this has to be someone with existing permissions)
  3. Edit the qateam@hgwdev authorized_keys file, and add the displayed authorized key for the other person then save.

Please note you should update the genecats repository version to reflect the additions. For example, cp authorized_keys ../../brianlee/genecats/qa/ssh/authorized_keys.new to then check the differences and update.

Updating known hosts

Very rarely a machine may change, for example in 2015 hgw5 was updated to a new machine. When this happens, the known_hosts file needs updating to allow connecting to hgw5, as a mismatched key will disallow connection (the different keys will suggest that hgw5 is an imposter and is not the hgw5 you originally connected to long ago, which is true, since there is a new hgw5).

To update this situation go to the .ssh directory and find the machine line in question and remove it from known_hosts, then try to connect again to the machine and you'll be asked to save the new key. Below is an example using a change where hgw5 is a new machine.

cd ~/.ssh
cat known_hosts | grep hgw5

(this is the line to remove)

emacs known_hosts   or vi known_hosts 

(remove hgw5 line with editor)

ssh qateam@hgw5

Reconnect with hgw5 and your known_hosts will save the new correct key for hgw5.