Tuesday, 26 May 2015

Cpanel Exim How To Clear The Mail Queue

 To  clear the exim mail queue on a cpanel server.

/etc/init.d/exim stop;
sleep 10;
killall -9 exim eximd
sleep 5;
#clean out the mail queue
find /var/spool/exim -mindepth 2 -type f -exec rm -rf {} \;
#clean out the mail db files
find /var/spool/exim/db -type f -exec rm -rf {} \;
#reset the eximstats database tables
echo “truncate table sends;” | mysql eximstats
echo “truncate table defers;” | mysql eximstats
echo “truncate table failures;” | mysql eximstats
echo “truncate table smtp;” | mysql eximstats
/etc/init.d/exim restart

Friday, 15 May 2015

Linux Basic Commands

To Print Working Directory
Print the name of the current working directory

[root@sanlinux~]# pwd

List of Files and Directories
To see the list of files and directories

[root@sanlinux~]# ls <options> <arguments>

Options

-l – Long list including attributes
-a – All files and directories including hidden
-d – For a particular file or directory
-R – Recursive to see the tree structure
Creation of files

Files can be created by using any of the three methods given below:

    Cat command
    Touch command
    Vi editor

Cat (Concatenation) Command
Creating and displayed text files

[root@sanlinux~]# cat <option> <arguments><filesname>

To create a file

[root@sanlinux~]# cat > <filename>

To view the contents of a file

[root@sanlinux~]# cat <files=name>

To append or add to an existing file

[root@sanlinux~]# cat >> <filename>

To combines the data of two or more files into a third file

[root@sanlinux~]# cat <first file> <second file> >> <third file>

Touch Command
To create a zero byte file

[root@sanlinux~]# touch <filename>

To create multiple zero byte files

[root@sanlinux~]# touch <first file> <second file> <third file>

To change the time stamp of a file or directory

[root@sanlinux~]# touch <directory or filename>

Vi Editor
To create file

[root@sanlinux~]# vi <filename>

Creating Directories
To create a directory

[root@sanlinux~]# mkdir <directory name>

To create multiple directories

[root@sanlinux~]# mkdir <first dir> <second dir> <third dir>

To create nested directories

[root@sanlinux~]# mkdir –p <first dir>/<second dir>/<third dir>

Navigation of Directories
To change the directory

[root@sanlinux~]# cd <path of the directory>

To change directory one level back

[root@sanlinux~]# cd ..

To change directory two levels back

[root@sanlinux~]# cd ../..

To change to the last working directory

[root@sanlinux~]# cd –

To change to the users home directory

[root@sanlinux~]# cd

Help or Manual Page
To view the manual page of a command

[root@sanlinux~]# man <command>

Copying
To copy a file or directory

[root@sanlinux~]# cp <options> <source file> <destination>

Options

-r – Recursive (to copy the directory along with its contents)
-v – Verbose
-p – Copy with permissions
Moving and Renaming
To move a file or directory to a different location

[root@sanlinux~]# mv <source file or directory> <destination>

Rename a file or directory

[root@sanlinux~]# mv <old name> <new name>

Deleting
To remove or delete an empty directory

[root@sanlinux~]# rmdir <directory name>

To remove or delete a file or directory

[root@sanlinux~]# rm <option> <file or directory name>

Options

-r – Recursive (directory along with contents)
-f – forcefully
Some other commands
To see the date

[root@sanlinux~]# date

To see the calendar

[root@sanlinux~]# cal

File Viewing Commands
To view the contents o f a file screen-wise

[root@sanlinux~]# less <file name>

To view the top lines of a file

[root@sanlinux~]# head <filename>

[root@sanlinux~]# head -5 <filename>

To view the bottom line of a file

[root@sanlinux~]# tail <filename>

[root@sanlinux~]# tail -3 <filename>

VI editor modes

VI editor has three modes of operations

    Command Mode
    Insert mode
    Ex Mode (Extended Command Mode)

Insert Mode

I – Insert the text at the current cursor position.
l – Insert the text in beginning of a line
a – Adds the text after the current cursor position
A – Adds the text at the end of a line
o – Insert the text one line below current cursor position
O – Insert the text one line above current cursor position
Ex mode

:q – Quit without saving
:q! – Quit forcefully without saving
:w – Write (save)
:wq – Save and quit
:wq! – Save and quit forcefully
:se nu – sets line numbers
:se nonu– Remove line numbers
:84 – The cursor goes to line 84
Command Mode

dd – Deletes a line
ndd – Deletes ‘n’ lines
yy – Copies a line
nyy – Copies ‘n’ lines
p – Put (pastes the deleted or copied text)
u – Undo(you can undo 1000 times)
G – Moves the cursor to the last line of the file

Sunday, 22 February 2015

Cpanel SSL 30days warning mails

Your server's SSL certificate for cpanel will expire in less than 30 days

I managed CentOs Server with Cpanel inside.
One day, I receive warning like this:
Your server's SSL certificate for cpanel will expire in less than 30 days. You need to install a new certificate as soon as possible. You can install a new certificate using WHM's "Manage Service SSL Certificates" interface: https://my.server.com:2087/scripts2/manageservicecrts (Main >> Service Configuration >> Manage Service SSL Certificates).

This warning is not indicate a problem in my server. This just a warning that I need to reset SSL certificate on my server. So here the solution to this warning:
  • I Login to my server via WHM.
  • Then I Go to "Service Configuration" menu and then to "Manage Service SSL Certificates" sub menu.
  • I Click "Reset Certificate" button that corresponding to the service which need a new certificate.
  • After that the self signed certificate is renewed for one year ahead.
I hope the above explanation will give solution to all of you too. Do you? Send your experience below

Thursday, 29 January 2015

Ezmlm Command Line Reference

 List all email addresses in list



ezmlm-list /path/to/mldir
 
/usr/local/bin/ezmlm/ezmlm-list   /home/vpopmail/domains/example.net/sample-list/
 
Add an email address to the list

ezmlm-sub /path/to/mldir san@test.com
 
/usr/local/bin/ezmlm/ezmlm-sub   /home/vpopmail/domains/example.net/sample-list/
 
 

Remove an email address from the list

ezmlm-unsub /path/to/mldir san@test.com
 
/usr/local/bin/ezmlm/ezmlm-unsub   /home/vpopmail/domains/example.net/sample-list/
 
 

 

Friday, 12 September 2014

Install and Configuration OpenSSH in FreeBSD

SSH is a secure version of telnet. It’a a protocol used to access the console or command line for remote system.

1. Installation

localhost# cd /usr/ports/security/openssh-portable

localhost# make config ; make install clean

2.  Configure

localhost# cp /etc/make.conf /etc/make.conf.old

localhost#  echo “NO_OPENSSH = YES” >> /etc/make.conf

localhost# cd /etc/ssh/

localhost# cp sshd_config sshd_config.old

localhost# cp sshd_config-dist ssh_config

localhost# /etc/rc.d/sshd restart

Stopping sshd.

Starting sshd.

localhost#ee /etc/rc.conf

add command :  sshd_enable=”YES”

this command is used to start ssh automatically

3. Testing

localhost# telnet localhost 22

Trying 127.0.0.1…

Connected to localhost.

Escape character is ‘^]’.

SSH-2.0-OpenSSH_5.1p1 FreeBSD-openssh-portable-overwrite-base-5.1.p1,1

press enter to quit. You should now be able to connect with any SSH-capable client and any valid user account other than root.

HowTo: Install or Upgrade Base OpenSSH for FreeBSD

Different methods to get the base installation of OpenSSH to be upgraded or installed.
### PORTS ###
from ports:

cd /usr/ports/security/openssh-portable
make UPDATE_INTREE_OPENSSH=yes
make install
make clean
### OR ###
for OpenSSL:

cd /usr/ports/security/openssl
make -DOPENSSL_OVERWRITE_BASE install
openssl version
for OpenSSH:

cd /usr/ports/security/openssh-portable
make -DOPENSSH_OVERWRITE_BASE=yes install
sshd -V
### PORTUPGRADE ###
for portinstall or portupgrade, prepare the MAKE_ARGS in /usr/local/etc/pkgtools.conf:

vi /usr/local/etc/pkgtools.conf

Look for an empty MAKE_ARGS and add the following to look like this:

MAKE_ARGS = {
'security/openssl' => 'OPENSSL_OVERWRITE_BASE=yes',
'security/openssh-portable' => 'OPENSSH_OVERWRITE_BASE=yes',
}
using portinstall:

portinstall -rRm "OPENSSH_OVERWRITE_BASE=yes" /usr/ports/security/openssh-portable/
using portupgrade:

portupgrade -rR openssh-portable-overwrite-base