Can anyone review the below script and please let me know if I am making any mistakes…for me script seems fine but getting error at the end
#!/bin/bash
Update system packages
sudo yum update -y
Install Postfix
sudo yum install -y postfix
Configure Postfix
sudo postconf -e ‘home_mailbox = Maildir/’
sudo postconf -e ‘mail_spool_directory = /var/mail/’
sudo postconf -e ‘virtual_alias_maps = hash:/etc/postfix/virtual’
sudo postconf -e ‘virtual_mailbox_domains = hash:/etc/postfix/vmailbox_domains’
sudo postconf -e ‘virtual_mailbox_maps = hash:/etc/postfix/vmailbox’
sudo postconf -e ‘virtual_mailbox_base = /var/mail/vhosts’
sudo postconf -e ‘virtual_uid_maps = static:5000’
sudo postconf -e ‘virtual_gid_maps = static:5000’
sudo postconf -e ‘smtpd_banner = $myhostname ESMTP $mail_name’
sudo postconf -e ‘myhostname = stratos.xfusioncorp.com’
sudo postconf -e ‘mydestination = localhost’
sudo postconf -e ‘relay_domains =’
sudo postconf -e ‘mynetworks = 127.0.0.0/8’
sudo postconf -e ‘inet_interfaces = all’
Create the user and set the password
sudo useradd kareem
echo ‘kareem:GyQkFRVNr3’ | sudo chpasswd
Set up the Maildir directory
sudo mkdir -p /home/kareem/Maildir
sudo chown -R kareem:kareem /home/kareem/Maildir
sudo chmod -R 700 /home/kareem/Maildir
Restart Postfix to apply the changes
sudo systemctl enable postfix
sudo systemctl restart postfix
Install Dovecot
sudo yum install -y dovecot
Configure Dovecot
sudo sed -i ‘s/^#mail_location =./mail_location = maildir:/home/%u/Maildir/’ /etc/dovecot/conf.d/10-mail.conf
sudo sed -i 's/^#user =./user = kareem/’ /etc/dovecot/conf.d/10-mail.conf
sudo sed -i ‘s/^#listen =.*/listen = *\n/’ /etc/dovecot/dovecot.conf
sudo sed -i ‘s/^#disable_plaintext_auth = yes/disable_plaintext_auth = no/’ /etc/dovecot/conf.d/10-auth.conf
sudo sed -i ‘s/^auth_mechanisms = plain/login/auth_mechanisms = plain login/’ /etc/dovecot/conf.d/10-auth.conf
sudo sed -i ‘s/^#ssl = required/ssl = no/’ /etc/dovecot/conf.d/10-ssl.conf
Restart Dovecot to apply the changes
sudo systemctl enable dovecot
sudo systemctl restart dovecot
echo “Postfix and Dovecot installation and configuration completed.”