mail issue
– 25 .. SMTP
– 110 .. POP3
– 143 .. IMAP
– 465 .. SMTPS, secured by SSL (legacy)
– 587 .. MSA, can be secured by STARTTLS command
– 993 .. IMAPS
– 995 .. POP3S
[root@ho 5]# locate 2366F12080DE [ mail id ]
OR postcat -q 2366F12080DE
/var/spool/postfix/defer/2/2366F12080DE
/var/spool/postfix/deferred/2/2366F12080DE
[root@ho 5]# cd /var/spool/postfix/deferred/2/
[root@ho 2]# ls
212BB120809F 2366F12080DE 2873612080C4 2CB1912080BF
[root@ho 2]# postcat 2366F12080DE | more
Mail ProbleM
start lets count the number of emails stuck in the mail server queue:
# postqueue -p | grep -c "^[A-Z0-9]"
# postqueue -p [show Q mail]
# postcat -q 47071F9C08
# mailq|grep ^[A-F0-9]|cut -c 42-80|sort |uniq -c|sort -n|tail
# find /var/spool/postfix/deferred -type f | wc -l
Requeue mails in a mail queue:
# postsuper -r ALL
#postqueue -f
# postsuper -d ALL [mail Q Delete]
# postsuper -d ALL deferred [remove all mails in the deferred queue ]
# mailq| grep '^[A-Z0-9]'|grep user@adminlogs.info|cut -f1 -d' ' |tr -d \*|postsuper -d -
#tail -f /var/log/maillog
#cat /var/log/maillog
#cat /var/log/maillog | grep smartecserver.com
Log
[root@ns1 ~]#tail -f /var/log/messages
[root@ns1 ~]# tail -f -n /var/log/message
here we will see some files nearly 10 lines
#cat /var/log/maillog | grep smartecserver.com [Domain name check]
logs for the error:
# egrep -r '(error|fatal|panic):' /var/log
Delete from mailq where subject matches
# cd /var/spool/postfix/deferred
# grep -r -i -l "This was the subject line" ./ | cut -d/ -f3 | postsuper -d -
How to delete emails based on subject?
Mail delivery failed: returning message to sender
# find . -type f -exec grep -i "Mail delivery failed: returning message to sender" -exec rm -v {} \;
Gmail Mail Block check:
[root@mail ~]# tcpdump -i eth1 | grep gmail
Mail Disk space
df -h
du -h --max-depth=1
cd /home/ftpadmin/
#cd /home
#du -h --max-depth=1
#du -h --max-depth=1 | sort
#du -h --max-depth=1 | grep career
#cd /home
#du -h --max-depth=1 | grep career
#du -h --max-depth=1 | grep shadin
#du -h --max-depth=1 | grep G
#exit
Mail Box ownership
# cd /home [ if mail box coppy]
chown -R mamun:mamun mamun
/home/mamun/Maildir/cur [mail inbox ]
/home/mamun/Maildir/.Sent/cur [send mail]
Remote Copy
scp -r root@203.82.196.18:/etc/postfix /root/f/ [ Remote linux pc ]
D:\>pscp.exe C:\Users\Administrator\Desktop\tINKERBWL.txt root@192.168.80.77:/root/f [windows to Linux]
D:\>pscp.exe -r root@192.168.80.77:/root/f C:\Users\Administrator\Desktop\ [Linux to windows]
Download pscp.exe: http://the.earth.li/~sgtatham/putty/latest/x86/pscp.exe
cd /f/postfix [Local pc]
cp -r * /etc/postfix
remote server IP TO own server
scp -r root@203.169.11.254:/home/u1/Maildir/new/* /home/u1/Maildir/new/
scp -r root@203.169.11.254:/home/u1/Maildir/new/* /home/u1/Maildir/new/
Remote server IP TO own server
scp -r root@worldcm.net:/home/kamal/Maildir/cur/* /home/u1/Maildir/cur/ --> # inbox mail [ mail show Runing Time]
chown -r u1:u1 /home/u1/Maildir/cur/ --> #[own server]
scp -r root@worldcm.net:/home/kamal/Maildir/.Sent/cur/* /home/u1/Maildir/.Sent/cur/ --> # sent mail
scp -r root@worldcm.net:/home/kamal/Maildir/cur/*.* /home/u1/Maildir/cur/
Remote TO Local Linux: SCP
Copy a Remote File to a Local System using the scp ommand [Remote To Local]
# scp remote_username@10.10.0.2:/remote/file.txt /local/directory
# scp -r username@example.com:/remote/path/to/directory /local/path
Coppy Command
# cp -p /etc/postfix/main.cf{,.bk}
Remote Coppy
Local to Remote Linux
# scp file.txt remote_username@10.1 0.0.2:/remote/directory [Local to Remote]
# scp /local/file/path username@example:/remote/path
To copy a directory from a local to remote system, use the -r option
# scp -r /local/directory remote_username@10.10.0.2:/remote/directory
If SSH port: 2322
# scp -P 2322 file.txt remote_username@10.10.0.2:/remote/directory
Remote TO Local Linux: SCP
Copy a Remote File to a Local System using the scp ommand [Remote To Local]
# scp remote_username@10.10.0.2:/remote/file.txt /local/directory
# scp -r username@example.com:/remote/path/to/directory /local/path
/home/mamun/Maildir/cur [mail inbox ]
/home/mamun/Maildir/.Sent/cur [send mail]
remote server IP TO own server
scp -r root@203.169.11.254:/home/u1/Maildir/new/* /home/u1/Maildir/new/
Remote server IP TO own server
scp -r root@worldcm.net:/home/kamal/Maildir/cur/* /home/u1/Maildir/cur/ --> # inbox mail [ mail show Runing Time]
chown -R u1:u1 /home/u1/Maildir/cur/ -->#[own server]
scp -r root@worldcm.net:/home/kamal/Maildir/.Sent/cur/* /home/u1/Maildir/.Sent/cur/ --> # sent mail
scp -r root@worldcm.net:/home/kamal/Maildir/cur/*.* /home/u1/Maildir/cur/
Windows
scp -r root@203.82.196.18:/etc/postfix /root/f/ [ Remote linux pc ]
scp -r root@203.82.196.18:/etc/postfix/*.* /root/f/ [ Remote linux pc ]
D:\>pscp.exe C:\Users\Administrator\Desktop\tINKERBWL.txt root@192.168.80.77:/root/f [windows to Linux]
D:\>pscp.exe -r root@192.168.80.77:/root/f C:\Users\Administrator\Desktop\ [Linux to windows]
Download pscp.exe: http://the.earth.li/~sgtatham/putty/latest/x86/pscp.exe
cd /f/postfix [Local pc]
cp -r * /etc/postfix
[root@localhost ~]# openssl passwd -crypt dhaKa1234
VCX97jg6iZebc
useradd -m -p <password> -s /sbin/nologin <user>
# useradd -m -p Bay1cN04XNI0M -s /sbin/nologin u4
[root@localhost ~]# openssl passwd -crypt Daka123
2J1oG/L2VPdXc
useradd -m -p <password> -s /sbin/nologin <user>
# useradd -m -p Bay1cN04XNI0M -s /sbin/nologin u4
Change Linux User’s Password in One Command Line
# echo -e "linuxpassword\nlinuxpassword" | passwd linuxuser
# echo "linuxpassword" | passwd --stdin linuxuser
# echo "abc1234" | passwd --stdin arif
User Lock
# passwd -l u1
And to unlock the account,
# passwd -u u1
Using Multiple SCP Options
Flags can be used with each other as well. Here is an example that implements multiple flags to copy a folder from a remote host to our local machine using a keypair file for authentication on port 44, while preserving file properties and supressing output:
# scp -p -q -P 44 -i path/to/local/keypair.pem -r path/to/local/folder user@remote-host:path/to/remote/folder
Step 4: Connect to SSH server on port # 2022 using SSH command:
ssh -p PortNumberHere user@server-name-here
ssh -p PortNumberHere user@server-name-here commandNameHere
ssh -p 2022 XYZ@192.168.1.5
ssh -p 2022 XYZ@192.168.1.5 df
To connect to an SSH server on port # 2022 using scp command type:
scp -P PortNumberHere source user@server-name-here:/path/to/dest
scp -P 2022 resume.pdf XYZ@nas01:/backups/personal/XYZ/files/
To connect to an SSH server on port # 2022 using sftp command type:
sftp -P PortNumberHere user@server-name-here
sftp -P 2022 XYZ@192.168.1.5
To connect to SSH server on port # 2022 using rsync command type:
Change SSH port number with rsync command:
sync -av -e 'ssh -p PORT-NUMBER-HERE' source user@server-name
So, to backup /home/XYZ to server1.XYZ.net.in at port number 2022, enter:
rsync -av -e 'ssh -p 2022' /home/XYZ/ backupop@server1.XYZ.net.i
cp command main options:
Erorr
open lock file /var/lib/postfix/master.lock: cannot open file: Permission denied
#chown -R postfix.postfix /var/lib/postfix
Feb 4 15:52:38 mail postfix/local[4394]: 80CCE1F206B5: to=<postfix@urmigroup.net>, relay=local, delay=0.05, delays=0.02/0/0/0.02, dsn=5.2.0, status=bounced (maildir delivery failed: create maildir file /var/spool/postfix/Maildir/tmp/1454579558.P4394.mail: Permission denied)
warning: maildir access problem for UID/GID=89/89: create maildir file /var/spool/postfix/Maildir/tmp/1572931820.P14891.mail.finlaydhaka.com: Permission denied
# mkdir -p Maildir /var/spool/postfix
# chown -R postfix:postfix /var/spool/postfix/Maildir
postfix/master[22015]: fatal: open lock file /var/lib/postfix/master.lock: unable to set exc...lable
We only need to kill the process and start postfix
Now ... Check to see if the file is there
# ls -l /var/lib/postfix/master.lock
Look for the process utilizing it
# htop
or simply do
# fuser /var/lib/postfix/master.lock7881
Now
# ps -ef | grep 7881 root 7881 1 0 Sep16 ? 00:00:09 /usr/libexec/postfix/master -w postfix 9127 7881 0 10:04 ? 00:00:00 pickup -l -t unix -u postfix 9469 7881 0 10:13 ? 00:00:00 smtpd -n smtp -t inet -u -o stress= -o smtpd_sasl_auth_enable=yes postfix 9470 7881 0 10:13 ? 00:00:00 proxymap -t unix -u postfix 9471 7881 0 10:13 ? 00:00:00 smtpd -n smtp -t inet -u -o stress= -o smtpd_sasl_auth_enable=yes postfix 9472 7881 0 10:13 ? 00:00:00 anvil -l -t unix -u postfix 9476 7881 0 10:13 ? 00:00:00 trivial-rewrite -n rewrite -t unix -u root 9486 8671 0 10:13 pts/0 00:00:00 grep --color=auto 7881 postfix 28581 7881 0 Sep17 ? 00:00:01 qmgr -l -t unix -u
Find the Process that uses the lock file
Kill the Process
# kill 7881
Now lets get back to postfix
# postfix status postfix/postfix-script: the Postfix mail system is not running
Now start it
# postfix start postfix/postfix-script: starting the Postfix mail system
-------------------------------------------------------------------------------------------
I first killed the smtp and smtpd processes that runs by postfix:
# killall -9 smtp
# killall -9 smtpd
But that didn’t solve the problem. I then used the fuser command to check which process holds the lock file:
# fuser /var/lib/postfix/master.lock
/var/lib/postfix/master.lock: 18698
Then we check the process 18698 and kill the responsible process:
# ps -axwww|grep 18698
9333 pts/0 S+ 0:00 grep --color=auto 18698
18698 ? Ss 4:28 /usr/libexec/postfix/master -w
# killall -9 /usr/libexec/postfix/master
or
# kill -9 18698
Once the process is killed, you can now start the postfix:
# service postfix start
# service postfix status|grep Active
To check sasl auth
tail -f /var/log/messages|grep sasl
tail -f /var/log/maillog|grep postfix
Some useful postfix commands
postqueue -p = mailq //postqueue -p is the same as mailq
service postfix reload //reload config
service postfix restart //restart postfix server
postconf mail_version //View the postfix version
postconf -d //Show default postfix values
postconf -n //Show non default postfix values
mailq //list mail queue and MAIL_ID's, list mail queue
postqueue -p //list mail queue and MAIL_ID's, list mail queue
postfix flush // flush mail queue
postqueue -f //process the queue now
postcat -q MAIL_ID //read email from mail queue
postsuper -d MAIL_ID //To remove MAIL_ID mail from the queue
postsuper -d ALL //To remove all mail from the queue
postsuper -d ALL deferred //To remove all mails in the deferred queue
# cat /var/log/maillog | grep dovecot | grep "merchandiser1"
Dovecote ISSUE
Starting Dovecot Imap: Error: service(pop3-login): listen(*, 110) failed: Address already in use Error: service(pop3-login): listen(*, 995) failed: Address already in use Error: service(imap-login): listen(*, 143) failed: Address already in use Error: service(imap-login): listen(*, 993) failed: Address already in use Fatal: Failed to start listeners [FAILED]
#yum remove psa-courier-imap
#kill dovecot
#killall -9 dovecot kills them all
solved core dump dovecot
if use redhat/fedora/centos just only run those command with root privileges
#/etc/init.d/dovecot stop
#echo 'DAEMON_COREFILE_LIMIT="unlimited"' >> /etc/sysconfig/dovecot
#/etc/init.d/dovecot start
SASL Issue
Fixing SASL support for Postfix --My SASL-Postfix configuration
nstall SASL support:
yum install cyrus-sasl*
#cat /etc/sasl2/smtpd.conf
pwcheck_method: auxprop auxprop_plugin: sasldb mech_list: CRAM-MD5 DIGEST-MD5 NTLM
#cat /etc/postfix/main.cf | grep sasl
smtpd_sasl_auth_enable = yes smtpd_sasl_local_domain = broken_sasl_auth_clients = yes smtpd_sasl_security_options = noanonymous, noplaintext
Postfix error: no SASL authentication mechanisms
#less /var/log/messages
filter postfix/smtpd[12154]: fatal: no SASL authentication mechanisms
Check mechanism files using:
# ls /usr/lib64/sasl2/
# yum list installed | grep cyrus-sasl
# yum remove cyrus-sasl-sql
-----------------------------------------------------------------------------------------------------
WEB
How to set up MailScanner, Clam Antivirus and SpamAssassin in CentOS mail server
http://xmodulo.com/mailscanner-clam-antivirus-spamassassin-centos.html
How to secure a mail server using encryption [ SASL-TSL]
http://xmodulo.com/secure-mail-server-using-encryption.html
How to enable user authentication for a Postfix SMTP server with SASL
http://xmodulo.com/enable-user-authentication-postfix-smtp-server-sasl.html
EXL Command :
=A1&" "&B1&C1&D1&" "&F1
Qmail
cat /var/log/qmail/qmail-send/current
cat /var/log/qmail/qmail-send/current | grep dbaeu.com
tail -f /var/log/qmail/qmail-send/current | grep dbaeu.com
tail -f /var/log/qmail/qmail-send/current | grep 19912
cd qmail-smtpd
841 cd /var/qmail/control/
842 ls
843 vi badmailfrom
844 ls
845 cat plusdomain
846 cat rcpthosts
847 cat smtproutes
848 cat /var/log/maillog | grep apllogistics
856 qmailctl queue
857 qmailctl queue
858 qmailctl stop
859 qmailctl start
867 cd /var/log/qmail/qmail-send/current
868 cd /var/log/qmail/qmail-send/current
869 tail -f /var/log/qmail/qmail-send/current
870 tail -f /var/log/qmail/qmail-send/current
-------------------------------------------------------------------------
http://pop3.your_domain.com/cgi-bin/qmailadmin
To block domain in QMAIL
cd /var/qmail/control/
vi badmailfrom
After that restart QMAIL below command :
qmailctl stop
qmailctl start
chkqmail
qmailctl queue
/home/vpopmail/bin/vuserinfo postmaster@silkroutedesignltd.com
/home/vpopmail/bin/
tail -f /var/log/qmail/qmail-
qmail-pop3d/ qmail-send/ qmail-smtpd/ qmail-smtpdssl/
vi /service/qmail-smtpd/run
cat /etc/tcp.smtp
[root@mail ~]# qmailctl stop
Stopping qmail...
qmail-smtpd
qmail-send
qmail-pop3d
[root@mail ~]# qmailctl cdb
Reloaded /etc/tcp.smtp.
[root@mail ~]# qmailctl start
ps -axu | grep qmail-send
kill -9 30915
--------------------------------------------------
purbanigroup.com
-------------------------------------------------------------------------------
# /usr/home/vpopmail/bin/vadddomain bizhat.com 123456
Now we will create an email account under bizhat.com domain that we just created.
# /usr/home/vpopmail/bin/vadduser info@bizhat.com 123456
This will create an email account info@bizhat.com with password 123456
freebsd# /usr/home/vpopmail/bin/vadddomain bizhat.com 123456
freebsd# /usr/home/vpopmail/bin/vadduser info@bizhat.com 123456
http://qmr.madkom.pl/install_rh.htm
---------------------------------------------------------
shahriar.aman@purbanigroup.com
/usr/home/vpopmail/bin/vadddomain puroup.com p123456P
/usr/home/vpopmail/bin/vadduser shahriar.aman@pugroup.com p123456P
http://mail.pugroup.com/cgi-bin/qmailadmin
#########################################################################################################################
Change Passwd Squirrelmail
cd /usr/share/squirrelmail/plugins/compatibility/
patch -p0 < patches/compatibility_patch-1.4.8.diff
Replace 1.4.8 with your SquirrelMail version. GEdit9. In the /usr/share/squirrelmail/plugins/change_passwd directory, copy the file config.php.sample and save it as config.php. Edit config.php and review the default settings. Below are settings in config.php you may wish to change * $minimumPasswordLength – Minimum length of the password. * $changePasswdInLogin – Change password from the login form. Test the SquirrelMail Change Password SquirrelMail1. Login to SquirrelMail and go to the Options page. You should see the new Change Password section. SquirrelMail2. Click the Change Password link to view the new Change Password page.
poppassd-1.8.5-lux.4.x86_64.rpm
4. Edit the file /etc/pam.d/poppassd and replace the content with the lines below.
auth required pam_unix.so
account required pam_unix.so
password requisite pam_cracklib.so
password sufficient pam_unix.so md5 shadow