0

I need to transfer files from Unix to Windows server. After creating a folder in the windows server files need to be copied from Unix to Windows. I am using psftp to do this process.So, I am trying to automate this process using shell script but I do not know how to connect Unix and Windows by using psftp in the shell script. Please some one guide me on this.

  • 2
    you can use winSCP: winscp.net/eng/index.php to copy from Unix to windows – Networker Jul 30 '14 at 15:37
  • Sorry, the direction you're headed in is unclear to me. You mention shell-script, which to me rings unix, but you mention psftp, which rings windows. Are you trying to pull from windows or push to it? – tink Jul 30 '14 at 20:40
  • @ tink I am transferring files from unix to windows daily. I wanna automate this porcess. – Aravind Jul 31 '14 at 9:55
0

I would suggest using an NFS mount to copy your files.

To install Services for NFS components:

  1. Click Start, point to Administrative Tools, and then click Server Manager.
  2. In the left pane, click Manage Roles.
  3. Click Add Roles. The Add Roles Wizard appears.
  4. Click Next. The Select Server Roles options appear.
  5. Select the File Services check box, and then click Next.
  6. The File Services screen appears. Click Next to view the Role Services options.
  7. Select the Services for Network File System (NFS) check box, and then click Next.
  8. Confirm your selection and click Install.
  9. When the installation completes, the installation results appear. Click Close.

http://technet.microsoft.com/en-us/library/dd758767%28v=ws.10%29.aspx

Creating a Windows 2008 NFS share:

  1. Right click on the folder you would like to share and select ‘Properties’.
  2. Select the NFS Sharing tab.
  3. Select ‘Manage NFS Sharing’ button.
  4. Check the ‘Share this folder’ at the top and make sure ‘Enable unmapped user access’ is checked with the ‘Allow unmapped user Unix access’ selected.
  5. Select the permissions button and make sure ‘Type of access’ is switched to Read_Write (Unless the share is solely used for Read only purposes) and check ‘Allow root access’
  6. Select OK and Apply.

**note – This only creates an NFS share and not a network share. To enable ‘Network File and Folder Sharing’ you will need to go to ‘Properties’ and select the Sharing tab. If you enable this feature make sure that you go to the Advanced Sharing options and change the permissions for ‘Everyone’ to full control.

Windows NFS share permissions: Windows has KeepInheritance turned off by default in the registry. Because of this, newly created files will not inherit the permissions from the parent share. To enable KeepInheritance:

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\ServerforNFS\CurrentVersion\Mapping\KeepInheritance

Change the value to 1. Then open ‘Services for Network File System’, right click on ‘Server for NFS’ and select ‘Stop Service’. Once the service has stopped, right click again and select ‘Start Service’.

Mounting a Linux System to a Windows NFS share:

$ mount –t nfs hostname:/nfs_share_name localpath

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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