Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix setting dovecot user as owner when Dovecot is not installed #1839

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion bin/v-add-mail-domain
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,12 @@ if [[ "$MAIL_SYSTEM" =~ exim ]]; then

# Set ownership
chown -R $MAIL_USER:mail $HOMEDIR/$user/conf/mail/$domain
chown -R dovecot:mail $HOMEDIR/$user/conf/mail/$domain/passwd
# Checking if dovecot user exists before set dovecot as owner. If dovecot user doesn't exist (dovecot is not installed), owner is assign to Exim user
if id "dovecot" >/dev/null 2>&1; then
chown -R dovecot:mail $HOMEDIR/$user/conf/mail/$domain/passwd
else
chown -R $MAIL_USER:mail $HOMEDIR/$user/conf/mail/$domain/passwd
fi
chown $user:mail $HOMEDIR/$user/mail/$domain_idn
fi

Expand Down
8 changes: 7 additions & 1 deletion func/rebuild.sh
Original file line number Diff line number Diff line change
Expand Up @@ -525,7 +525,13 @@ rebuild_mail_domain_conf() {
chmod 771 /etc/$MAIL_SYSTEM/domains/$domain_idn
chmod 770 $HOMEDIR/$user/mail/$domain_idn
chown -R $MAIL_USER:mail $HOMEDIR/$user/conf/mail/$domain
chown -R dovecot:mail $HOMEDIR/$user/conf/mail/$domain/passwd

# Checking if dovecot user exists before set dovecot as owner. If dovecot user doesn't exist (dovecot is not installed), owner is assign to Exim user
if id "dovecot" >/dev/null 2>&1; then
chown -R dovecot:mail $HOMEDIR/$user/conf/mail/$domain/passwd
else
chown -R $MAIL_USER:mail $HOMEDIR/$user/conf/mail/$domain/passwd
fi
chown $user:mail $HOMEDIR/$user/mail/$domain_idn
fi

Expand Down
8 changes: 7 additions & 1 deletion upd/fix_exim_permissions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,13 @@ if [ -e "/etc/exim4/domains/" ]; then
domain_link=$(readlink /etc/exim4/domains/$domain)
chown Debian-exim:mail $domain_link
chown Debian-exim:mail /etc/exim4/domains/$domain/*
chown dovecot:mail /etc/exim4/domains/$domain/passwd

# Checking if dovecot user exists before set dovecot as owner. If dovecot user doesn't exist (dovecot is not installed), owner is assign to Exim user
if id "dovecot" >/dev/null 2>&1; then
chown -R dovecot:mail /etc/exim4/domains/$domain/passwd
else
chown -R $MAIL_USER:mail /etc/exim4/domains/$domain/passwd
fi
done
fi

Expand Down