#!/bin/bash
run_service_as=sshd
SYSCONFDIR=/etc
LOCALSTATEDIR=/var

# Found using: egrep "chown|chgrp|chmod" /bin/ssh-host-config
chown "${run_service_as}" ${SYSCONFDIR}/ssh*
chown "${run_service_as}".544 ${LOCALSTATEDIR}/empty
chown "${run_service_as}".544 ${LOCALSTATEDIR}/log/lastlog
chown "${run_service_as}".544 ${LOCALSTATEDIR}/log/sshd.log
chmod 775 "${SYSCONFDIR}"
chmod 775 "${LOCALSTATEDIR}/log"
chmod 644 ${LOCALSTATEDIR}/log/lastlog
chmod 755 "${LOCALSTATEDIR}/empty"

# Found using: /usr/share/csih/cygwin-service-installation-helper.sh
chmod 1777 "${LOCALSTATEDIR}/run"

# These are redundant or conflicting with previous settings
#chmod 1777 "${LOCALSTATEDIR}/log"
#chmod 755 "${LOCALSTATEDIR}/empty"
#chmod 755 "${SYSCONFDIR}"
