Skip to main content

Sendmail Installation & configuration on centos with virtual user and domains

The Sendmail program is a very widely used Mail Transport Agent (MTA). MTAs send mail from one machine to another. Sendmail is not a client program, which you use to read your email. Sendmail is a behind-the-scenes program which actually moves your email over networks or the Internet to where you want it to go.. 
This guide show you have to install and configure sendmail with virtual user and domains - 
Installation  -

Check if sendmail is installed or not:
   # rpm –qa | grep sendmail 

If it is not installed, then install the sendmail package using following command:
   # yum install sendmail sendmail-cf

By default sendmail listen on local interface i.e 127.0.0.1
To configure the sendmail to listen to all interface at the host, just comment the following line in “sendmail.mc”:

# vi /etc/mail/sendmail.mc

     From:
     DAEMON_OPTIONS(`Port=smtp,Addr=127.0.0.1, Name=MTA')dnl

     To
     dnl DAEMON_OPTIONS(`Port=smtp,Addr=127.0.0.1, Name=MTA')dnl

Accepting mail for virtual domains/users
1.Create a new system user and set the password for that user.




useradd exampleuser
passwd exampleuser
2. Add the user to the sendmail’s virtusertable file. Open the ‘/etc/mail/virtusertable’ file and add the following:
Each line in the /etc/mail/virtusertable file should be of the following format:


username@domainname systemuser
3. Add each new domain name to the /etc/mail/local-host-names file


exampledomain.tld
4. Generate a new sendmail.cf file by using the following commands:




cd /etc/mail
make all
/etc/init.d/sendmail restart
Rewriting outgoing email addresses
1. Add the following lines to the /etc/mail/sendmail.mc file:

1
2
3
FEATURE(masquerade_envelope)
FEATURE(genericstable, `hash -o /etc/mail/genericstable')
GENERICS_DOMAIN_FILE(`/etc/mail/sendmail.gdf')

2. Create /etc/mail/genericstable file containing local users mapped to desired addresses:



exampleuser exampleuser@exampledomain.tld
exampleuser2 exampleuser2@exampledomain.tld


3. Create /etc/mail/sendmail.gdf file containing the fully qualified name of the local mail server.


host.exampledomain.tld

4. Finally, generate a new sendmail.cf file:




cd /etc/mail
make all
/etc/init.d/sendmail restart

DONE ...

:)









Comments

Popular posts from this blog

how to take mails backup in outlook 2007

How to take backup of mails in outlook 2007. there is a very simple way to taking backup of mails 1.Opne outlook 2007 > tools >account > data files >open folder then close all other windows and copy outlook.pst file in a safe location To restore backup 1.Opne outlook 2007 > tools >account > data files > add > and give the location of outlook.pst file.

Configure Vsftpd with virtual users in Ubuntu 14.04

vsftpd is a GPL licensed FTP server for UNIX systems, including Linux. It is secure and extremely fast. It is stable. Don't take my word for it, though. Below, we will see evidence supporting all three assertions. We will also see a list of a few important sites which are happily using vsftpd. This demonstrates vsftpd is a mature and trusted solution. To configure vsftpd server  with virtual users we need to enable PAM for vsftpd. apt-get install vsftpd libpam-pwdfile Now configure vsftpd to use PAM authentication vim  /etc/vsftpd.conf then paste in the following listen=YES anonymous_enable=NO local_enable=YES write_enable=YES local_umask=022 local_root=/var/www chroot_local_user=YES allow_writeable_chroot=YES hide_ids=YES #virutal user settings user_config_dir=/etc/vsftpd_user_conf guest_enable=YES virtual_use_local_privs=YES pam_service_name=vsftpd nopriv_user=vsftpd guest_username=vsftpd Now create users - You can either use a data...

AWS Certification RoadMap