From a013c0317e7be8fc933058b3d080351fdc644b0e Mon Sep 17 00:00:00 2001 From: Christoph Date: Mon, 19 Apr 2021 01:43:54 +0200 Subject: [PATCH] Add Webserver user (www-data) to group 'dovecot' if not already done. --- install_update_dovecot.sh | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/install_update_dovecot.sh b/install_update_dovecot.sh index 8a70321..91ed69b 100755 --- a/install_update_dovecot.sh +++ b/install_update_dovecot.sh @@ -177,6 +177,8 @@ if $xmpp_listener ; then [[ -n "$xmpp_listener_port" ]] || xmpp_listener_port="44444" fi +[[ -n "$http_user" ]] || http_user="www-data" + [[ -n "$dbname" ]] || dbname="postfix" [[ -n "$dbuser" ]] || dbuser="postfix" if [[ -z "$dbhost" ]] ; then @@ -694,6 +696,19 @@ else echo -e "$rc_skipped" fi +echononl "\tAdd Apache User (${http_user}) to group 'dovecot'.." +if getent group dovecot 2> /dev/null | grep -q "\b${http_user}\b" > /dev/null 2>&1 ; then + echo -e "$rc_skipped" +else + usermod -a -G dovecot $http_user > ${_log_dir}/system.log 2>&1 + if [[ $? -eq 0 ]] ; then + echo -e "$rc_done" + else + echo -e "$rc_failed" + error "Failed to add Apache User (${http_user}) to group 'dovecot'!" + fi +fi + echononl "\tCreate group dovenull.." if ! grep dovenull /etc/group > /dev/null ; then