1*4882a593Smuzhiyun#!/bin/sh -e
2*4882a593Smuzhiyun#
3*4882a593Smuzhiyun# rc.local
4*4882a593Smuzhiyun#
5*4882a593Smuzhiyun# This script is executed at the end of each multiuser runlevel.
6*4882a593Smuzhiyun# Make sure that the script will "exit 0" on success or any other
7*4882a593Smuzhiyun# value on error.
8*4882a593Smuzhiyun#
9*4882a593Smuzhiyun# In order to enable or disable this script just change the execution
10*4882a593Smuzhiyun# bits.
11*4882a593Smuzhiyun#
12*4882a593Smuzhiyun# By default this script does nothing.
13*4882a593Smuzhiyun# Generate the SSH keys if non-existent
14*4882a593Smuzhiyunif [ ! -f /etc/ssh/ssh_host_rsa_key ]
15*4882a593Smuzhiyunthen
16*4882a593Smuzhiyun    # else ssh service start in dpkg-reconfigure will fail
17*4882a593Smuzhiyun    systemctl stop ssh.socket||true
18*4882a593Smuzhiyun    dpkg-reconfigure openssh-server
19*4882a593Smuzhiyunfi
20*4882a593Smuzhiyun
21*4882a593Smuzhiyunexit 0
22