OpenVZ Forum


Home » General » Support » "S15ssh_gen_host_keys" script not executed after creating new container (ssh)
"S15ssh_gen_host_keys" script not executed after creating new container [message #45663] Wed, 28 March 2012 09:20 Go to next message
mgielissen is currently offline  mgielissen
Messages: 5
Registered: January 2012
Junior Member
I've created a custom debian 6 template.

I've followed these instructions:

cat << EOF > /etc/rc2.d/S15ssh_gen_host_keys
#!/bin/sh
ssh-keygen -f /etc/ssh/ssh_host_rsa_key -t rsa -N ''
ssh-keygen -f /etc/ssh/ssh_host_dsa_key -t dsa -N ''
rm -f \$0
EOF

chmod a+x /etc/rc2.d/S15ssh_gen_host_keys


But after creating a container, the ssh keys aren't generated. The official debian 6 template has a ssh_key_hack.sh?
Re: "S15ssh_gen_host_keys" script not executed after creating new container [message #45665 is a reply to message #45663] Wed, 28 March 2012 10:01 Go to previous message
mgielissen is currently offline  mgielissen
Messages: 5
Registered: January 2012
Junior Member
I've found the solution and it works:

cat << EOF > /etc/init.d/ssh_gen_host_keys
#!/bin/sh
### BEGIN INIT INFO
# Provides:          Generates new ssh host keys on first boot
# Required-Start:    $remote_fs $syslog
# Required-Stop:     $remote_fs $syslog
# Default-Start:     2 3 4 5
# Default-Stop:
# Short-Description: Generates new ssh host keys on first boot
# Description:       Generates new ssh host keys on first boot
### END INIT INFO
ssh-keygen -f /etc/ssh/ssh_host_rsa_key -t rsa -N ""
ssh-keygen -f /etc/ssh/ssh_host_dsa_key -t dsa -N ""
insserv -r /etc/init.d/ssh_gen_host_keys
rm -f \$0
EOF

chmod a+x /etc/init.d/ssh_gen_host_keys
insserv /etc/init.d/ssh_gen_host_keys
Previous Topic: OpenVZ (RHEL6 2.6.32) and Java - kown issues?
Next Topic: abnormal memory centos EL6 64
Goto Forum:
  


Current Time: Mon Sep 16 21:00:00 GMT 2024

Total time taken to generate the page: 0.06262 seconds