5

Problem Statement- I want to copy some files from remote machine (linux) to my windows machine. I know I can do it using pscp.

I tried looking on the internet, I found several articles, but in those articles I was not able to understand and I was having lot of problems in copying the files from Linx box to Windows.

Can anyone provide me step by step method here, so that I can follow that to transfer files. That will be of great help to me.

I am connected to host cli.vip.host.com using putty and that is linux with username- rkost and password as- password. And I want to copy file a.txt from linux to windows.

AKIWEB
  • 19,008
  • 67
  • 180
  • 294
arsenal
  • 23,366
  • 85
  • 225
  • 331

5 Answers5

8
  1. Download PSCP from below link

    https://www.chiark.greenend.org.uk/~sgtatham/putty/latest.html

  2. Run PSCP

  3. Got to command prompt

  4. Use the below code

    Copy single file

    pscp user@host:remote_path/file_name host_path\file_name
    
    eg: pscp user1@192.168.1.10:/home/user2/a.txt c:\Desktop\a.txt
    

    Copy all files in a folder

    pscp user@host:remote_path/* host_path\ 
    
    eg: pscp user1@192.168.1.10:/home/user2/* c:\Desktop\test\ 
    

    Copy all files & folders in a folder

    pscp -r user@host:remote_path/ host_path\
    
    eg: pscp -r user1@192.168.1.10:/home/user2/ c:\Desktop\test\
    
pvrforpranavvr
  • 2,708
  • 2
  • 24
  • 34
  • is it possible to tar a directory on linux and send it to windows using pscp? – amandanovaes Jun 04 '19 at 02:16
  • 2
    In the third case I had to use -r and also /home/user2/* with the asterisk from the second example, otherwise it stopped with the error "security violation" – raujonas Mar 20 '21 at 10:38
  • After installing POWERSHELL wow64_microsoft-windows-powershell-exe you can open the terminal and execute this command line pscp -r -P (Port as 2222) user@(domain or IP):(path as /var/www/html/WEB) (WINDOWS path as C:\2023\WEB) – coopeu Feb 01 '23 at 16:07
0

For this kind of problem I use all the time netcat. First, you start netcat as server on a machine with an ip IP_address, and afterwards you send the file from the other machine.

nc -l -p <port-number> > out_file

will start it as server in "listen" state, and will save what you send to it in the file "out_file".(check the man page of your version for more parameters.)

From the other machine you send the file something like this:

 < file_to_send nc IP_address

(If you want to send an whole directory, you use tar )

I never used it under Windows (because I work as linux engineer). But you can find nc for windows, that work the same as in linux...

Jon Lin
  • 142,182
  • 29
  • 220
  • 220
alinsoar
  • 15,386
  • 4
  • 57
  • 74
  • There is a direct way to copy using ssh (you do not neet to install scp). If you look at the command "ssh", you see that its last optional parameters are [user@]hostname [command]. So, instead of executing a remote shell, you can replace the default "bash" by a command, and you can copy so: ssh user@ip cat _file_ >out. This will copy the remote _file_ into the local file "out". scp is syntactic sugar for this call of ssh. – alinsoar Jun 28 '12 at 19:23
0

if you want to use pscp, you can do this:

pscp -pw password rkost@cli.vip.host.com:/path/to/file c:\path\

if this doesn't work try to add enviroment variable:

set PATH=C:\path\to\putty\directory;%PATH%
0

After installing POWERSHELL wow64_microsoft-windows-powershell-exe you can open the terminal and execute this command line

pscp -r -P Port user@IP:path WINDOWS path

example: pscp -r -P 2222 user@MyDommain.com:/var/www/html C:\2023\HTML

coopeu
  • 83
  • 5
-1
  1. Make sure you are connected to your vpn server, (i.e. cli.vip.host.com)
  2. use following command from your windows machine

    pscp -v rkost@remote_ip_addr:/path/to/file/a.txt c:/some_location/

  3. you can see the verbose with -v flag.

  4. If you wants to copy directory from remote linux machine to your windows just refer my answer in this PSCP copy files from godaddy to my windows machine
Community
  • 1
  • 1
vikram eklare
  • 800
  • 7
  • 25