Rsync an email server

Posted on 2009-12-29
Last Modified: 2013-12-17
I am looking to setup a Rsync backup of a sendmail server running on Ubuntu.  I would like to send the backup to a NAS on the network.

I tried the following command but it does not appear to be sending to the NAS though the command appears to be processing (so I believe maybe its backing up locally instead).  I would like a full backup minus the excludes I threw in.

rsync -av / \\\share\emailserver\ --exclude  "/share/" --exclude "/mnt/" --exclude "/proc/"

Question by:aiscom
    LVL 1

    Expert Comment

    The first question that comes to mind is; when running as root, can you look at the target directory?

    # ls \\\share\emailserver\

    rsync needs to be able to see/write to the target directory for it to work and crontab processes are run as the owner of that process, normally root.  You can setup cron jobs for normal users, but that user would have to have access to all of the sendmail files and folders.


    Author Comment

    There are no restrictions on that share on the NAS.  

    If I do the above command though, it simply says "ls: \ No such file or directory".
    LVL 1

    Accepted Solution

    Ahh... I missed it the first time around "\" is a shell escape flag and needs protection.

    Notice the error "\"

    The \\ became \, because the first one protected the second.  The others protected the letters that followed them...  Two possible options, depending on how your system is setup.

    1 - Use single quotes to protect the back slashes from the shell:

    2 - I suspect it is not really mounted on your system.  Run the mount command and see what file systems your box knows about. As I said, if you can't use ls to look at it, rsync can't write to it.

    HOWTO: Mounting SMB/CIFS Shares


    Featured Post

    Find Ransomware Secrets With All-Source Analysis

    Ransomware has become a major concern for organizations; its prevalence has grown due to past successes achieved by threat actors. While each ransomware variant is different, we’ve seen some common tactics and trends used among the authors of the malware.

    Join & Write a Comment

    Email signatures have numerous marketing benefits. Here are 8 top reasons to turn your email signature into a marketing channel.
    Granting full access permission allows users to access mailboxes present in their database. By giving full access permission one can open and read the content of any mailbox but cannot send emails from that mailbox.
    In this video we show how to create a mailbox database in Exchange 2013. We show this process by using the Exchange Admin Center. Log into Exchange Admin Center.: First we need to log into the Exchange Admin Center. Navigate to the Servers >> Data…
    This tutorial will walk an individual through the steps necessary to enable the VMware\Hyper-V licensed feature of Backup Exec 2012. In addition, how to add a VMware server and configure a backup job. The first step is to acquire the necessary licen…

    755 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    16 Experts available now in Live!

    Get 1:1 Help Now