[vox-tech] ssh host key generation in init script

Wes Hardaker wjhns156 at hardakers.net
Thu Dec 24 08:26:39 PST 2009


>>>>> On Wed, 23 Dec 2009 17:53:59 -0800, Nick Schmalenberger <nick at schmalenberger.us> said:

NS> when ls is true. I also tried
NS> test -f /etc/ssh/ssh_host_* || /usr/sbin/dpkg-reconfigure

Maybe
  file=`grep 'HostKey' /etc/ssh/sshd_config | awk '{print $NF}`
  test -f $file

But the problem is that in fedora, for example, the HostKey line is
commented out because it uses the default of /etc/ssh/ssh_host_key.  The
question is, do distributions change that via a patch or always use the
sshd_config file for changing the location?  If the later, the above is
safe though you'd want to remove comments and make it:

  file=`egrep '^ *HostKey' /etc/ssh/sshd_config | awk '{print $NF}`
  if test "x$file" = "x" ; then
     file=/etc/ssh/ssh_host_key
  fi

  ... test -f $file

-- 
Wes Hardaker                                     
My Pictures:  http://capturedonearth.com/
My Thoughts:  http://pontifications.hardakers.net/


More information about the vox-tech mailing list