mirror of
https://github.com/containers/youki
synced 2024-11-10 03:31:41 +01:00
32 lines
692 B
Bash
32 lines
692 B
Bash
#!/bin/bash
|
|
|
|
set -x
|
|
|
|
# change sshd config
|
|
|
|
file="$1"
|
|
param[1]="PermitRootLogin "
|
|
param[2]="PubkeyAuthentication"
|
|
param[3]="PasswordAuthentication"
|
|
if [ -z "${file}" ]
|
|
then
|
|
|
|
file="/etc/ssh/sshd_config"
|
|
fi
|
|
|
|
for PARAM in ${param[@]}
|
|
do
|
|
/usr/bin/sed -i '/^'"${PARAM}"'/d' ${file}
|
|
/usr/bin/echo "All lines beginning with '${PARAM}' were deleted from ${file}."
|
|
done
|
|
|
|
/usr/bin/echo "${param[1]} yes" >> ${file}
|
|
/usr/bin/echo "'${param[1]} yes' was added to ${file}."
|
|
/usr/bin/echo "${param[2]} yes" >> ${file}
|
|
/usr/bin/echo "'${param[2]} yes' was added to ${file}."
|
|
/usr/bin/echo "${param[3]} no" >> ${file}
|
|
/usr/bin/echo "'${param[3]} no' was added to ${file}"
|
|
|
|
# reload config
|
|
service sshd reload
|