Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I need to find a way to transfer the daily backup folder of my Debian server to a Windows server weekly. What would be the easiest and most stable way to achieve this? Would I definitely need a Samba installation on my Debian server?

share|improve this question
up vote 0 down vote accepted

MS-Windows shared folder: You can share data between windows and linux system for such use : For example you would like to access MS-Windows share called //windowsserver/sharename by mounting to /mnt/win directory under Linux system. So execute these commands:

mkdir -p /mnt/win
mount -t smbfs -o username=winntuser,password=mypassword //windowsserver/sharename /mnt/win
Next create the password file /etc/sambapasswords:

cat > /etc/sambapasswords 
username = winntuser
password = mypassword
make sure that only root have access to it

chown root:root /etc/sambapasswords
chmod 600 /etc/sambapasswords
Add an entry to your /etc/fstab:

//windowserver/share /mnt/win smbfs
auto,gid=users,fmask=0664,dmask=0775,iocharset=iso8859-15, credentials=/etc/sambapasswords 0 0
Append an entry to your crontab like this, if you need to do a backup daily at 1AM:

0 1 * * * cp /path/to/yourbackup /mnt/win 
FTP solution: you may install a ftp server on your windows machine. filezilla server do perfectly the job. setup a ftp folder and an account with all required privileges. Later setup a file named ~/.netrc with this content:

machine windowserver
login ftpuser
password ftppassword
make sure that only root have access to it:

chown root:root ~/.netrc
chmod 600 ~/.netrc
Append to your backup script this lines that will transfer your backup file remotely to your ftp server:

ftp <<EOF
open windowserver
cd ${remote_path}
put ${filename}
Finally add your backup script to your crontab like what we did for first solution.

share|improve this answer

You can also do this with rsync. Set up a rsync server at the Linux machine, and use a rsync client at the Windows machine to get the files.

With rsync, you will be able to resume interrupted transfers

share|improve this answer

Here is my script in order to communicate with our windowser server. You need to add a share (ie Samba share) on the windows box :

# Script d'envoi des archives 

cd /mount directory
mount -t cifs //SMB-SHARE share name/ -o username=USER,password=PASSWORD,dir_mode=0777,file_mode=0777

umount share
share|improve this answer
I do almost exactly the same thing as Kronick describes for an hourly copy from a Linux to a Windows machine. – Keith Stokes Sep 16 '09 at 11:19
This is the best, most easy, and most stable way to do this. No servers to set up - just make sure the samba client is installed on the Linux machine, which is probably already is. – Dave Drager Sep 16 '09 at 13:01

Another way will be to actually pull the needed files away from the Linux server from the Windows server, using pscp (from the putty package)

share|improve this answer
And like Nik says above, if you use key authentication, you can script it. – Clay Kimber Sep 16 '09 at 14:12

You could setup freeSSHd on the Windows server and script a secure copy from the Debian server.
Also consider setting up public key authentication for easier scripting.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.