21-usersetup: check for existing /bin/zsh inside the chroot
[grml-live.git] / etc / grml / fai / config / scripts / GRMLBASE / 49-sshd
1 #!/bin/bash
2 # Filename:      ${GRML_FAI_CONFIG}/config/scripts/GRMLBASE/49-sshd
3 # Purpose:       adjust sshd configuration file
4 # Authors:       grml-team (grml.org), (c) Michael Prokop <mika@grml.org>
5 # Bug-Reports:   see http://grml.org/bugs/
6 # License:       This file is licensed under the GPL v2 or any later version.
7 ################################################################################
8
9 set -u
10 set -e
11
12 if ! [ -r "${target}/etc/ssh/sshd_config" ] ; then
13   echo "File /etc/ssh/sshd_config doesn't exist, skipping execution of script."
14   exit 0
15 fi
16
17 # make sure root login works, it's set to "without-password" since openssh-server v1:6.6p1-1
18 sed -i "s/^\(PermitRootLogin without-password\)/# \1 # disabled via grml-live\nPermitRootLogin yes/" "${target}/etc/ssh/sshd_config"
19
20 # speedup if DNS is broken/unavailable
21 if grep -q '^UseDNS' "${target}/etc/ssh/sshd_config" ; then
22   sed -i "s/^\(UseDNS yes\)/# \1 # disabled via grml-live\nUseDNS no/" "${target}/etc/ssh/sshd_config"
23 else
24   echo "# Added via grml-live script:" >> "${target}/etc/ssh/sshd_config"
25   echo "UseDNS no" >> "${target}/etc/ssh/sshd_config"
26 fi
27
28 ## END OF FILE #################################################################
29 # vim:ft=sh expandtab ai tw=80 tabstop=4 shiftwidth=2