[K12OSN] ssh key generation

Henry Burroughs hburroughs at HHPREP.ORG
Wed May 26 15:24:14 UTC 2004

According to the ssh_config manual, there should/can be a
/etc/ssh/ssh_known_hosts file in which you can can place the destination
host public key. You could copy a clean .ssh/known_hosts file or you
could use something like "ssh-keyscan", which is designed to scan many
hosts and retrieve the public keys (aka generate your ssh_known_hosts
file).  Do "man ssh-keyscan" to check it out... in the examples section
it shows how to retrieve the rsa protocol 2 (it by default gets rsa1...
aka protocol 1 of ssh).

Doing this would keep you from having to create a new known_hosts file
for new users, and if you ever update or add a new host it will be
easy... just add/change it in ssh_known_hosts.  I have never tried this,
however it looks like it should work.

Henry Burroughs

Patrick Mohr wrote:
> I am not faminure with making a known hosts file, but you should be able 
> to use a login shell script somthing to this effect.
> You will need to make changes, since I don't know what a known hosts 
> file looks like.
> #!/bin/bash
> if ! [ -f ~/.ssh/known_hosts ]
>     then cd ~/.ssh
>     touch known_hosts
>     chown $USER:$USER known_hosts
>     chmod 644 known_hosts
>     echo "localhost ssh-rsa AAAAB351gcOGYmCk=" >> known_hosts
>     echo "This will apear on the secound line" >> known_hosts
> fi
> ______________________________________________________________________
> _______________________________________________
> K12OSN mailing list
> K12OSN at redhat.com
> https://www.redhat.com/mailman/listinfo/k12osn

More information about the K12OSN mailing list