Linux Backup with TAR and Cron

Level: Intermediate
Length of Class: 35 Minutes

Backup commands
# sudo tar -cvpzf backupnamedate.tar.gz –exclude=/mnt /

Recovery commands (Create /recover directory first)
sudo tar -xvpzf backupnamedate.tar.gz -C /recover

Introduction to Linux
Installing Linux
Basic Linux Tasks
VIM for File Editing
Navigation in Linux
Users, Groups and Permissions in Linux
Purpose of Class

This class teaches students how to backup directories using TAR, and demonstrates how to schedule tasks using Cron Jobs.

Topics Covered
Backing Up Directories with TAR
Recovering Directories with TAR
Setting Up Cron Jobs for Scheduled Tasks
Class Notes

Backup Using TAR
Backup = sudo tar –cvpzf backup.taz.gz –exclude/=directory (recursive) PATH
–c = create new file (overwrites old file)
–v = verbose
–p = preserve permissions
–z = compress
–f = filename (very important)
–exclude=DIRCECTORY is Recursive
Naming Files with time = filename-$(date +%F-%T)
Recover Files from a TAR File
Recover = sudo tar –xvpzf FILE –C /DIRECTORY
Capital -C = change to directory
-x = extract

Cron Jobs
To Edit the Crontab File = sudo cron –e (first time it will ask you your default editor)
Format = minute (0-59), hour (0-23, 0 = midnight), day (1-31), month (1-12), weekday (0-6, 0 = Sunday), command
* Wildcard for Every Minute/Day/Hour/Month?Day of Week
Example to Backup Entire Server for 1am Every Morning = 0 1 * * * sudo tar -cvpzf /backup.tar.gz –exclude=/mnt /

Redo Backup & Recovery


Redo Backup and Recovery for Linux or Windows system is so simple that anyone can use it and the best it’s FREE!!!. It is the easiest, most complete disaster recovery solution available. It allows bare-metal restore. Bare metal restore is not only the best solution for hardware failure, it is also the ultimate antivirus: Even if your hard drive melts or gets completely erased by a virus, you can have a completely-functional system back up and running in as little as 10 minutes.


All your documents and settings will be restored to the exact same state they were in when the last snapshot was taken. Redo Backup and Recovery is a live CD, so it does not matter if you use Windows or Linux. You can use the same tool to backup and restore every machine. And because it is open source released under the GPL, it is completely free for personal and commercial use.

More Features, Less Complex

Redo Backup has the most features coupled with the simplest, most user-friendly interface:

– Easy graphical user interface boots from CD in less than a minute
– No installation needed; runs from a CD-ROM or a USB stick
– Saves and restores Windows and Linux machines
– Automatically finds local network shares
– Access your files even if you can’t log in
– Recover deleted pictures, documents, and other files
– Internet access with a full-featured browser to download drivers
– Live CD download size is only about 250MB

Will test this tool tomorrow 😉 & keep you posted! 3/6/2016 11:18pm


Perfect tool to have,!!! Worked like a charm!

3/7/2016 7:57pm

Suggestion : Backup the /www/html/ folders before & reborn the webserver files after! 😉


~ The best bare metal LINUX or WINDOWS system backup & restore tool out there for free!

How to install Perl SYSLOG on Centos 7

I was running into some problem with CSF (Config Server Security Firewall)

In the Edit Config Server Firewall (Loggin Settings) I noticed that LFD was not automatically blocking attacks on the server.

Log lfd messages to SYSLOG in addition to /var/log/lfd.log. You must have the
perl module Sys::Syslog installed to use this feature

I had to install the Sys::Syslog perl module to make it work.

[root]# yum install perl-Sys-Syslog

Restart CSF and check the message log to see if there is any error like:

localhost systemd: Unit lfd.service entered failed state.
localhost systemd: lfd.service failed.

All working good now 😉

What is ?


Usermin is a web-based interface for webmail, password changing, mail filters, fetchmail and much more. It is designed for use by regular non-root users on a Unix system, and limits them to tasks that they would be able to perform if logged in via SSH or at the console. See the standard modules page for a list of all the functions built into Usermin.

Who can use Usermin?

Most users of Usermin are sysadmins looking for a simple webmail interface to offer their customers. Unlike most other webmail solutions, it can be used to change passwords, read email with no additional servers installed (like IMAP or POP3), and setup users’ Procmail configurations for forwarding, spam filtering and autoreponders.

Usermin also provides web interfaces for viewing and managing data in MySQL and PostgreSQL databases, editing Apache .htaccess configuration files, and running commands on the server. The administrator has full control over which of these modules are available to users.

Usermin and Webmin integration

By far the easiest way to configure Usermin is via the Usermin Configuration module in Webmin. All functionality can be managed via a browser, and because both products come from the same developer the management user interface is always up to date.

Install Dovecot on CentOS 7

Install Dovecot to configure POP/IMAP server. POP uses 110/TCP, IMAP uses 143/TCP

This example shows to configure to provide SASL function to Postfix.

[root@mail ~]# vi /etc/dovecot/dovecot.conf

# line 24: uncomment
protocols = imap pop3 lmtp

# line 30: uncomment and change ( if not use IPv6 )
listen = *

[root@mail ~]# vi /etc/dovecot/conf.d/10-auth.conf

# line 10: uncomment and change ( allow plain text auth )
disable_plaintext_auth = no

# line 100: add
auth_mechanisms = plain login

[root@mail ~]# vi /etc/dovecot/conf.d/10-mail.conf

# line 30: uncomment and add
mail_location = maildir:~/Maildir

[root@mail ~]# vi /etc/dovecot/conf.d/10-master.conf

# line 96-98: uncomment and add like follows
# Postfix smtp-auth
unix_listener /var/spool/postfix/private/auth {
mode = 0666
user = postfix
group = postfix

[root@mail ~]# vi /etc/dovecot/conf.d/10-ssl.conf
# line 8: change (not require SSL)
ssl = no

[root@mail ~]# systemctl start dovecot

[root@mail ~]# systemctl enable dovecot

Dovecot automatically create a folders for us 🙂

vim /etc/dovecot/conf.d/20-imap.conf

At the end of file paste following code

plugin {
autocreate = Trash
autocreate2 = Junk
autocreate3 = Drafts
autocreate4 = Sent
autosubscribe = Trash
autosubscribe2 = Junk
autosubscribe3 = Drafts
autosubscribe4 = Sent


# Space separated list of plugins to load (default is global mail_plugins).

mail_plugins = $mail_plugins
plugin {
autocreate = Trash
autocreate2 = Junk
autocreate3 = Drafts
autocreate4 = Sent
autosubscribe = Trash
autosubscribe2 = Junk
autosubscribe3 = Drafts
autosubscribe4 = Sent

Having problems with folders?

Check out the /home/username/Maildir to see if all the directory are created. If not here is the list of folder to create:


* Make sure to add the folders to roundcube in the “Manage Folders”

Also you have to Change ownership to user:user you have created.

Working now on the .Inbox problem, will keep you posted

Why I don’t receive my email into the .Inbox?


Install phpmyadmin in CENTOS 7


Step 1: Add the EPEL Repository

phpMyAdmin is part of Extra Packages for Enterprise Linux (EPEL), which is a community repository of non-standard packages for the RHEL distribution. First, we’ll install the EPEL repository:

rpm -iUvh

Step 2: Install phpMyAdmin

First, you’ll follow a simple best practice: ensuring the list of available packages is up to date before installing anything new.

yum -y update

Then it’s a matter of just running one command for installation via apt-get:

yum -y install phpmyadmin

Step 3: Find Your IP Address

Step 4: Basic Configuration for phpMyAdmin

To secure phpMyAdmin we should lock down access to a specific IP address. When the phpMyAdmin package is installed, an Apache Virtual Host file is added to configure web access. Let’s edit that file:

vim /etc/httpd/conf.d/phpMyAdmin.conf

By default, the configuration for phpMyAdmin only allows access from the server on which it is installed. Find the following sections and change each IP address to the one you found in Step 3, or another IP address that will be connecting to phpMyAdmin remotely:

Require ip

Allow from

Require ip

Allow from

Then exit and save the file with the command :wq .

Restart Apache:

systemctl restart httpd

Verify that phpMyAdmin is working by visiting http://the_IP_of_your_server/phpmyadmin. For example:

Also you will have to go remove the password authetification in the phpmyadmin conf file

After those steps simply create a user with the desired password and all privilege granted!

Et voilà!