Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I have a file on CentOS machine that needs to be copied to Windows NT server.

I use \10.10.10.10 to connect to the server from my windows desktop. I can copy the files using the GUI,

but I want to write a shell script on my centOS server that will periodically copy files to windows box.

share|improve this question
    
why not make a script on windows that runs periodically and copies the file? –  quamis Jun 8 '11 at 12:22

4 Answers 4

up vote 2 down vote accepted

Mount the Windows NT server on your CentOS machine:

mkdir /mnt/windows
mount -t cifs -o user=your-windows-username //10.10.10.10/Share /mnt/windows

Requires smbfs/cifs. From here on, it's just normal cp or rsync or whatever you want to do.

share|improve this answer
    
This is the correct answer. But how do I set the ownership of the mounted partition to "companyuser". I guess it is not possible as it is part of another server. –  shantanuo Jun 9 '11 at 6:45

There is another option not mentioned here. You can use the PuTTY suite of tools, specifically pscp to copy a file from the CentOS box to the Windows box. Get pscp (google) and use the command prompt in the directory where pscp resides:

pscp root@ip.of.centos.box:/path/to/file .

This will copy the file to the current directory.

share|improve this answer

You could map a share with samba from the windows server on your centos box. Then it is a normal cp command you have to do.

You can find the needed information in smbclient howto.

share|improve this answer
    
# You must have smbfs support compiled into your kernel to use these (smbmount) utilities! # How do I enable this? # thanks for your quick answer. –  shantanuo Jun 8 '11 at 12:13
    
What version of centos is it? All the versions I know have it already compiled into. –  Raffael Luthiger Jun 8 '11 at 14:55
    
# cat /etc/redhat-release # Red Hat Enterprise Linux Server release 5.5 (Tikanga) –  shantanuo Jun 9 '11 at 6:01

As it's an NT server I'm going to assume that this is in a closed environment where security isn't an overwhelming issue (if I'm wrong then why are you still using NT?).

If you don't have smbfs support on your CentOS machine, as suggested by your comment to Raffael's answer, you could enable the NT machine's FTP server and use scripted FTP commands to perform the file transfer.

share|improve this answer

Your Answer

 
discard

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.