Peter's Blog

Redefining the Impossible

smbfs


Backing up linux ubuntu intranet stuff to central windows server using rsync and smbfs. I did this as follows:

  • Create new windows user with limited priviledges, apart from writing backup files. The intranet server will have permanent access to the windows server and access priviledges should not be too generous.
  • Install smbfs:
    sudo apt-get install smbfs
    
  • Add following to /etc/fstab
    //{server name}/{share name} /mnt/{target} smbfs rw,username={windows username}, \
              password={windows password},uid={linux username},gid={linux username} 0 0
    
    uid and gid are necessary to get write permission.
  • Mount share:
    sudo mount /mnt/{target}
    
  • Create a backup directory on the windows server. Since it is only a backup I made this compressed.
  • Add a cron entry to copy stuff over every night:
    34 3 * * 1-5 rsync -a --delete --exclude="\\.*" \
              /home/pcw/StuffToBackup/ /mnt/{target}/users/PCW/BACKUP
    
    Windows does not like file names that start with a . so I exclude these.

Filed under: backup linux rsync samba ubuntu

Anonymous Says:

over 2 years ago

Thanks bud. Now I don't have to rely on the incompetent IT people to backup my documentation (they left it not backing up for 3 months)

Have Your Say

I welcome constructive comments or questions but I reserve the right to delete any comments that displease me.

Who are you?

(Optional) If you enter an email address here I might email you back. Your email address will not be sold to spammers or shown anywhere

What do you have to say?