multiple ssh known_hosts files

Matt Graham mhgraham at crow202.org
Sat Oct 29 12:13:37 MST 2016


On 2016-10-28 16:49, der.hans wrote:
> I have a need to import a read-only known_hosts file in addition to
> using my local known_hosts file.

> I thought I had it covered with the UserKnownHostsFile in 
> ~/.ssh/config,
> but new hosts and IPs are being written to that file rather than
> ~/.ssh/known_hosts.

This option can take multiple files.  Sort of like so:

UserKnownHostsFile ~/.ssh/known_hosts /etc/ssh/system_hosts

The source for sshconnect.c in version 7.3p1 says that if things get 
added, they get added to the first file in the list of hosts files.  I 
tried this:  I removed all the entries for server1 from my 
~/.ssh/known_hosts and added them to /etc/ssh/system_hosts (owned by 
root and 644), then verified I could still ssh to server1 as my normal 
user.  I removed all the entries from /etc/ssh/system_hosts , then tried 
to ssh to server1.  ssh asked me if I wanted to add the host key, and 
added it to my ~/.ssh/known_hosts and things were fine.

If I misunderstood this or there's something else that needs to happen 
here, please say something.  Hope This Helps,

-- 
Crow202 Blog: http://crow202.org/wordpress
There is no Darkness in Eternity
But only Light too dim for us to see.


More information about the PLUG-discuss mailing list