FTP-ing files from Windows server to UNIX server

I need to transfer files from a Windows server to the Unix server and have to run some shell script on it to get the required output.

Is it possible to transfer files from Windows server to unix server through any shell script?

If so can you please help me with the details.

Thanks in Advance.

Dear ssk250,
I have a few to questions pose in response first:-

  • What have you tried so far?
  • What output/errors do you get?
  • What OS and version are you using?
  • What are your preferred tools? (C, shell, perl, awk, etc.)
  • What logical process have you considered? (to help steer us to follow what you are trying to achieve)

Most importantly, What have you tried so far? You can script up ftp or sftp which will help you move the file. What else do you need to do after that?

There are probably many ways to achieve most tasks, so giving us an idea of your style and thoughts will help us guide you to an answer most suitable to you so you can adjust it to suit your needs in future.

We're all here to learn and getting the relevant information will help us all.

Robin

  1. I have tried the sftp command in the below format
sftp username@<ipaddress>
  1. It is just showing
Connecting to <ipaddress>....

for a long time and is not returning any ouput or error

  1. I am trying to run the sftp command from unix system with solaris version SunOS 5.10
    The windows version from which I need to fetch the required files is Microsoft windows server 2008(32-bit)

  2. I want to write the code in SHELL (shell script)

  3. Basically what I am trying to do is to get the files from the windows server to the unix server through sftp ,,which is not working in this case. Just want to know why it is not connecting . Is it the fact that I need some permissions need to be setup to open the ports for SFTP? and also any other process I need to do for sftp to happen
    and also if sftp is not possible for this case ,,, is there any other method to get this

Thanks

If your message is just connecting, does it eventually time out? (30 seconds or longer)

This could be a number of things. let's consider these (maybe not exhaustive list):-

  • Is there an sftp service running on the Windows server?
    .
  • You suggest you use the IP address in the sftp command, but there could still be a name resolution issue. If the client is IP address, then that's fine if that's what you want to do. The server will try to reverse lookup the incoming request though. Can you try a ping unix.ip.address from the Windows server. If that's okay, can you try nslookup unix.ip.address from there too? Do you get a fast & valid response (even if it's a not-found)
    .
  • You might have an invalid route somewhere. Try traceroute windows.ip.address from unix and tracert unix.ip.address from windows and see how far you get matching them up with how the network man would expect them to go.
    .
  • You may have a firewall preventing you from opening the connection. I can't really advise on that though.

Does this get you any further?

Robin

1 Like

My guess is that the windows system is running ftp rather than sftp. I would try connecting to the windows system with an ftp client to test this theory.

I think he needs ssh for sftp. ftp is not secure. here is a nice, free, windows ssh server: freeSSHd and freeFTPd - open source SSH and SFTP servers for Windows

Dear orange47,

It depends on his application needs, risk exposure and technology rather than just saying "ftp is not secure." We have many servers that do not support SFTP, so we have to work with what we have.

True, it's better but sftp is not uncrackable either.

We will have to wait for the Original Poster to tell us some more.

Robin

There is no native support for sftp on Windows Server 2008. There is native support for ftps, i.e. ftp over ssl. You have to install third party app.

Assuming sftp is available, it's usually a LOT easier to use scp, which is also normally available with sftp.

Instead of using sftp and trying to parse textual outputs to determine success, just use scp like you'd use cp or copy and check the return value.