class Net::SSH::KnownHosts

def hostfiles(options, which = :all)

the second option.
If you only want the user known host files, you can pass :user as

(/etc/ssh/ssh_known_hosts and /etc/ssh/ssh_known_hosts2).
:global_known_hosts_file is not set, the default is used
default is returned (~/.ssh/known_hosts and ~/.ssh/known_hosts2). If
hosts files. If the :user_known_hosts_file key is not set, the
:global_known_hosts_file keys, and returns an array of all known
Looks in the given +options+ hash for the :user_known_hosts_file and
def hostfiles(options, which = :all)
  files = []
  files += Array(options[:user_known_hosts_file] || %w[~/.ssh/known_hosts ~/.ssh/known_hosts2]) if which == :all || which == :user
  if which == :all || which == :global
    files += Array(options[:global_known_hosts_file] || %w[/etc/ssh/ssh_known_hosts /etc/ssh/ssh_known_hosts2])
  end
  return files
end