From 1b970de4591575e18f21f6d33f664702a46e31f8 Mon Sep 17 00:00:00 2001 From: gau1991 Date: Tue, 2 Sep 2014 18:57:43 +0530 Subject: [PATCH] Better way to add and delete user --- src/modules/stack/install/mail/ee_mod_setup_dovecot.sh | 2 +- src/modules/stack/remove/mail/ee_mod_remove_dovecot.sh | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/src/modules/stack/install/mail/ee_mod_setup_dovecot.sh b/src/modules/stack/install/mail/ee_mod_setup_dovecot.sh index a22d254a..662fac7c 100644 --- a/src/modules/stack/install/mail/ee_mod_setup_dovecot.sh +++ b/src/modules/stack/install/mail/ee_mod_setup_dovecot.sh @@ -12,7 +12,7 @@ function ee_mod_setup_dovecot() ee_lib_echo "Setting up Dovecot, please wait..." # Adding mail user with GID 5000 and UID 5000 - groupadd -g 5000 vmail && useradd -g vmail -u 5000 vmail -d /var/vmail -m \ + adduser --uid 5000 --home /var/vmail --disabled-password --gecos '' vmail \ || ee_lib_error "Unable to setup vmail user/group = " $? # Configuring dovecot.conf diff --git a/src/modules/stack/remove/mail/ee_mod_remove_dovecot.sh b/src/modules/stack/remove/mail/ee_mod_remove_dovecot.sh index 199540f2..b929b43b 100644 --- a/src/modules/stack/remove/mail/ee_mod_remove_dovecot.sh +++ b/src/modules/stack/remove/mail/ee_mod_remove_dovecot.sh @@ -6,7 +6,8 @@ function ee_mod_remove_dovecot() $EE_APT_GET $EE_SECOND dovecot-core dovecot-imapd dovecot-pop3d dovecot-lmtpd dovecot-mysql dovecot-sieve dovecot-managesieved \ || ee_lib_error "Unable to $EE_SECOND Dovecot, exit status = " $? - userdel -rf vmail || ee_lib_error "Unable to Remove user vmail, exit status = " $? + deluser --remove-home vmail &>> $EE_COMMAND_LOG || ee_lib_error "Unable to Remove user vmail, exit status = " $? rm -f /etc/init.d/dovecot + rm -rf /var/vmail }