LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   How to copy a file from my linux machine to remote window machine (https://www.linuxquestions.org/questions/linux-server-73/how-to-copy-a-file-from-my-linux-machine-to-remote-window-machine-4175574583/)

SSR 03-11-2016 12:44 AM

How to copy a file from my linux machine to remote window machine
 
I am able to copy the file from window machine to linux machine via pscp but i wanted to know is there any command by which i can copy the file from linux machine to windows machine.
Please help if anyone know about the same.
Thanks in Advance.:)

pan64 03-11-2016 12:57 AM

it depends on what is installed on windows. If you have shared a directory (and C$, D$ usually available) you can mount it on your linux and a simple copy should do the job.

SSR 03-11-2016 01:03 AM

Thanks pan64 for your rply .
So I cant use SCP to copy the file from linux server to window server ??Can you share me the steps how can i share the directory of window server and mount it to the linux server .
NOTE: both linux and window server are remote .

pan64 03-11-2016 02:02 AM

you can use scp if an scp server was installed on the windows side. I do not know anything about that. I suggest you to check:
http://www.cri.ch/linux/docs/sk0001.html
http://www.howtogeek.com/168115/moun...ux-with-samba/

sundialsvcs 03-11-2016 10:04 AM

I think that the best general approach is to "bloom where you are planted." In other words, connect to the remote system using standard network file-sharing in a manner most-well supported by that host. Linux, Samba, etc. makes it easy to connect to a Windows shared network, and to participate fully in such a network as a true peer. Thus, you simply mount the share (logging-in to the Windows network unless it automagically recognizes you), and copy the files to-and-fro as you see fit. Exactly as you would do if you weren't (ick ...) using Linux. :)

edenCC 03-15-2016 02:40 AM

I'd use shttpd to run a tiny web server on Linux, then use windows to download from it.

fmattheus 03-15-2016 11:16 AM

He doesn't need to run a webserver on linux. Linux already has ssh running. He already knows how to use pscp to copy files from windows to linux. He just needs to learn how to use pscp to pull files from linux to windows.

Instead of calling it like this
Code:

pscp sourcefile user@host:targetdir
call it like this
Code:

pscp user@host:sourcedir/file targetfile

frankbell 03-15-2016 09:30 PM

Most Linux distros come with Samba client installed. Check your distro to find out whether it does. You do not need Samba server for what I will describe below.
  1. Share a Windows directory in the Windows directories property dialog. Be sure to use simple sharing. Do not use Windows homegroup sharing; it works only with other Windows devices. Preferably the directory should be within your C:/users/[username] directory.
  2. Put the file into that shared directory on the Windows machine.
  3. Open the file manager on the Linux machine and browse to the shared directory on your Windows machine. If your file manager does not discover the directory, you can enter the Windows machine into the address bar of your file manager, like this
    Code:

    smb://[ip address of Windows machine]
  4. Find the file and copy and paste it to the target directory on your Linux machine.

If you run into any problems, post them to this thread, including any error messages you get.

Doug G 03-15-2016 09:55 PM

If you're initiating the transfer from the windows computer, winscp works very well.

sundialsvcs 03-18-2016 08:53 AM

The "putty" package on the Windows side is a good, reliable client. Yes, they prefixed the letter "p" to all of their command-names, which is actually rather annoying, but otherwise it's directly on-par with the Linux equivalents. Their SSH-agent is called "pagent." (Or is it the English word, "pageant?" I don't recall.) Anyhow, everything you need to do SSH from the Windows world, and I believe also to provide an SSH daemon on Windows, is all there.

allend 03-18-2016 06:41 PM

If you can access the remote Windows machine using RDP, then you can use the '-r disk:' option to rdesktop (a Linux RDP client) to have a directory on your Linux machine appear in the Windows file manager.

chrism01 03-21-2016 05:21 AM

I'm with fmattheus; just do pscp pull instead of a push; no need to use another tool or setup file sharing.


All times are GMT -5. The time now is 10:55 PM.