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?
5 Answers
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

- 756
- 4
- 5
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 :
#!/bin/sh
# 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

- 2,276
- 1
- 19
- 23
-
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)

- 18,802
- 6
- 49
- 64
-
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.
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:
#!/bin/bash
filename=yourbackupfile
ftp <<
EOF
open windowserver
bin
verbose
prompt
cd ${remote_path}
put ${filename}
bye
EOF
Finally add your backup script to your crontab like what we did for first solution.
- 3,850
- 2
- 24
- 36