Tuesday 23 December 2014

Copy a folder under linux server to windows server

Make Mounting Directory

mkdir -p /mnt/win
mount -t smbfs/cifs -o username=winntuser,password=mypassword //window-server-address-or-ip/foldername /mnt/win ( both cifs/smbfs work )


Next create the password file /etc/sambapasswords:

nano /etc/sambapasswords - then enter the credential as follows:

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/cifs
auto,gid=users,fmask=0664,dmask=0775,iocharset=iso8859-15,credentials=/etc/sambapasswords 0 0

Make a Cron Job !

crontab -e

0 1 * * * cp /path/to/yourbackup /mnt/win 

Which mean a backup daily at 1AM.

No comments:

Post a Comment