The .ssh/known_hosts file

In order to use public-key secure connection with other hosts (ssh, scp, sftp) there is a special directory, ~/.ssh/, where passphrases and public keys are stored. Normally you wouldn't need to know the gory details, but from time to time a host will change its public key and then you have difficulty using ssh or scp with that host, and have to edit a file named known_hosts.

If you try to ssh to another computer, but get an error message that warns about a changed or incorrect public key, then it is probably just a case of that host changing its public key. (It is possible, though usually not the case, that malicious hacking is involved.) Unless you actually suspect hacker involvement, you can edit the file ~/.ssh/known_hosts using your usual text editor (vi, emacs, nedit, or pico) and delete any line with the name of that host.

Then when you try to ssh that host again, it will be like the first time ever; ssh will ask you if you want to accept a new public key, you type the whole word yes, and everything will proceed normally from there.

Here is what a typical ~/.ssh/known_hosts file might contain. Note that newton is represented on two different lines:

newton 1024 35 153438062610297067329638677441205712613292203533062535600064224677647442245028855505387934431717435134842994423656065076260604296084868001730665553662299156116414854701274715680961503198280525759778667306417179500370189017139564144825610347509023078143132936185076849630461827976942220442313116255293297021841
ucsub 1024 37 132170811640421742212085598383135714069016332111955003414250071326834884018721183646445780180633494496866895830879394309011412231102757022090299732775466435482517698989962531081214859205054227533597152962802400251809883548442498002326460312850336779152617243800769119880843882425555806081435017335194477605333
simpson 1024 41 84089692059249458440345362273528263453600205470157624776507876697481412839375294315107162983484390901602702661279164375297211645960275026726690836525966507273615949171966757621717137045892868050436884725563247792566023489318554721885765548457461907512536847079297627580626353420887972219277539015703446529603
newton,128.138.249.8 ssh-rsa AAAAB3NzaC1yc2EAAAABIwAAAIEA0d7Aoure0toNJ+YMYi61QP2ka8m5x5ZQlT7obP8CK3eropfqsMPPY6uiyIh9vpiFX2r1LHcbx139+vG6HOtVvuS8+IfMDtawm3WQvRuOopz3vVy5GtMwtaOgehsXoT930Ryev1bH5myPtWKlipITsOd2sX9k3tvjrmme4KCGGss=