[Last Call] Learn how to a build a cloud-first strategyRegister Now

  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 534
  • Last Modified:

Rsync an email server

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/"

  • 2
1 Solution
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.

aiscomAuthor Commented:
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".
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

Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now