Pscp from linux to windows

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's user avatar

AKIWEB

19.1k67 gold badges181 silver badges294 bronze badges

asked Jun 28, 2012 at 18:49

arsenal's user avatar

  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 [email protected]:/home/user2/a.txt c:\Desktop\a.txt
    

    Copy all files in a folder

    pscp user@host:remote_path/* host_path\ 
    
    eg: pscp [email protected]:/home/user2/* c:\Desktop\test\ 
    

    Copy all files & folders in a folder

    pscp -r user@host:remote_path/ host_path\
    
    eg: pscp -r [email protected]:/home/user2/ c:\Desktop\test\
    

answered Jan 5, 2018 at 6:09

pvrforpranavvr's user avatar

pvrforpranavvrpvrforpranavvr

2,7282 gold badges24 silver badges34 bronze badges

3

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's user avatar

Jon Lin

142k29 gold badges220 silver badges220 bronze badges

answered Jun 28, 2012 at 19:11

alinsoar's user avatar

alinsoaralinsoar

15.4k4 gold badges57 silver badges74 bronze badges

1

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

pscp -pw password [email protected]:/path/to/file c:\path\

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

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

answered Apr 4, 2014 at 7:26

user3493540's user avatar

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 [email protected]:/var/www/html C:\2023\HTML

answered Feb 1 at 16:14

coopeu's user avatar

  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's user avatar

answered Jan 16, 2017 at 11:36

vikram eklare's user avatar

vikram eklarevikram eklare

8101 gold badge8 silver badges25 bronze badges

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's user avatar

AKIWEB

19.1k67 gold badges181 silver badges294 bronze badges

asked Jun 28, 2012 at 18:49

arsenal's user avatar

  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 [email protected]:/home/user2/a.txt c:\Desktop\a.txt
    

    Copy all files in a folder

    pscp user@host:remote_path/* host_path\ 
    
    eg: pscp [email protected]:/home/user2/* c:\Desktop\test\ 
    

    Copy all files & folders in a folder

    pscp -r user@host:remote_path/ host_path\
    
    eg: pscp -r [email protected]:/home/user2/ c:\Desktop\test\
    

answered Jan 5, 2018 at 6:09

pvrforpranavvr's user avatar

pvrforpranavvrpvrforpranavvr

2,7282 gold badges24 silver badges34 bronze badges

3

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's user avatar

Jon Lin

142k29 gold badges220 silver badges220 bronze badges

answered Jun 28, 2012 at 19:11

alinsoar's user avatar

alinsoaralinsoar

15.4k4 gold badges57 silver badges74 bronze badges

1

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

pscp -pw password [email protected]:/path/to/file c:\path\

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

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

answered Apr 4, 2014 at 7:26

user3493540's user avatar

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 [email protected]:/var/www/html C:\2023\HTML

answered Feb 1 at 16:14

coopeu's user avatar

  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's user avatar

answered Jan 16, 2017 at 11:36

vikram eklare's user avatar

vikram eklarevikram eklare

8101 gold badge8 silver badges25 bronze badges

Windows 10 now has OpenSSH built in.
https://docs.microsoft.com/en-us/windows-server/administration/openssh/openssh_install_firstuse

Get an admin command prompt

Open PowerShell as an Administrator.

Check available versions

Get-WindowsCapability -Online | ? Name -like 'OpenSSH*'

Install client

Add-WindowsCapability -Online -Name OpenSSH.Client~~~~0.0.1.0

Install server

Add-WindowsCapability -Online -Name OpenSSH.Server~~~~0.0.1.0

Start server and enable at boot

Start-Service sshd
Set-Service -Name sshd -StartupType 'Automatic'

Find your Windows IP address

ipconfig

On your remote (Linux) machine, find your IP address.

ifconfig

Create a public SSH key

ssh-keygen.exe

Copy public key from local (Windows) to remote (Linux) machine so you don’t have to type in a password all the time.

Note that ssh-copy-id is not currently available on Windows.

cat C:\Users\YOU/.ssh/id_rsa.pub | ssh USER@REMOTE_IP 'mkdir -p ~/.ssh && cat >> ~/.ssh/authorized_keys'

Do the same on your Linux machine (Note, ssh-copy-id does not work)

ssh-keygen # if needed
cat ~/.ssh/id_rsa.pub | ssh USER@WINDOWS_IP 'mkdir -p ~/.ssh && type con >> C:/Users/YOU/.ssh/authorized_keys'
  • The method above did not work for me, so I ended up manually SCPing the public key over and pasting it into the C:/Users/YOU/.ssh/authorized_keys file.

  • That still did not work, so I had to modify the sshd_config file.

    • Open Notepad as Administrator

    • Open %programdata%\ssh\sshd_config

    • Add the following lines:

        Match User YOU
             AuthorizedKeysFile C:/Users/YOU/.ssh/authorized_keys
  • Reboot

Create a password on Windows if you don’t already have one

System Settings...Sign-in options

— Note, you can still disable the Windows login screen by a) Setting the ‘Require sign-in’ option to never and b) Using the ‘netplwiz’ command and unticking the ‘Users must enter password…’ checkbox.

Now you should be able to SSH or SCP from your Linux machine

scp FILE WINDOWS_IP:C:/Users/YOU/Desktop

В статье мы расскажем, как копировать файлы в Windows и Linux-системах, и покажем основные команды, с помощью которых происходит передача файлов по SSH.

Для копирования файлов по SSH в Linux-системах и Windows используют разные инструменты:

  • scp (Secure CoPy) — утилита для безопасного копирования данных между Linux-системами по протоколу SSH. Она входит в состав OpenSSH, поэтому для работы с утилитой не нужно устанавливать дополнительное ПО;
  • pscp.exe — утилита для загрузки файлов по SSH в ОС Windows. Она обладает теми же возможностями, что и scp. Утилита входит в состав программы Putty — SSH-клиента для Windows. Скачать программу можно по ссылке.

Обратите внимание

Если файл, который вы хотите скопировать, уже существует на целевом хосте, при копировании он будет перезаписан.

Копирование файлов по SSH на Linux

Для Linux копирование файлов по SSH происходит с использованием команды scp. С её помощью можно копировать файлы:

  • с локального компьютера на удалённый сервер,
  • с удалённого сервера на локальный компьютер,
  • с одного удалённого сервера на другой.

Общий вид команды:

scp [опция] [источник] [получатель]

Обратите внимание

Для подключения к удалённому серверу вам понадобится логин и пароль пользователя.

Как скопировать файл по SSH с локальной машины на удалённый сервер

Как загрузить файл на сервер по SSH? Для этого используйте команду вида:

scp [путь к файлу] [имя пользователя]@[имя сервера/ip-адрес]:[путь к файлу]

Пример команды:

scp /home/test.txt root@123.123.123.123:/directory

Файл test.txt будет скопирован на хост 123.123.123.123 в директорию «/directory».

Как скопировать файлы с удалённого сервера на локальный компьютер

При подключённом SSH скачать файл на локальный компьютер с удалённого сервера можно с помощью команды:

scp [имя пользователя]@[имя сервера/ip-адрес]:[путь к файлу] [путь к файлу]

Пример команды:

scp root@123.123.123.123:/home/test.txt /directory

Файл test.txt будет загружен с сервера 123.123.123.123 на локальный компьютер в папку «/directory».

Как скопировать файл по SSH с одного удалённого сервера на другой

Подключитесь по SSH к серверу, на котором расположен файл. Затем выполните команду:

scp [путь к файлу] [имя пользователя]@[имя сервера/ip-адрес]:[путь к файлу]

Пример команды:

scp /home/test.txt root@123.123.123.123:/directory

Файл test.txt будет скопирован на хост 123.123.123.123 в директорию «/directory».

Как скачать папку со всеми файлами и подпапками

Если вы хотите скачать папку со всеми файлами и подпапками, используйте ключ -r:

scp -r [источник] [получатель]

Как подключиться к серверу по нестандартному порту

Бывает, что для подключения по SSH нужно указать нестандартный порт. Без указания порта команда подключается к серверу по стандартному 22 порту. Чтобы указать нестандартный порт, введите команду с ключом -P:

scp -P [источник] [получатель]

Пример команды:

scp -P 12345 /home/test.txt root@123.123.123.123:/directory

Эта команда подключается по порту 12345 к серверу 123.123.123.123 и копирует на него файл «test.txt» с локального компьютера в директорию «/directory».

Как передать и скачать файлы по SSH на Windows

Скопировать файл по SSH на сервер можно командой:

pscp [путь к файлу] [имя пользователя]@[имя сервера/ip-адрес]:[путь к файлу]

Скачать файл по SSH с сервера командой:

pscp [имя пользователя]@[имя сервера/ip-адрес]:[путь к файлу] [путь к файлу]

Увидеть список папок и файлов на сервере можно через pscp.exe. Для этого введите:

pscp -ls [имя пользователя]@[имя сервера/ip-адрес]:[путь]

Если в пути или в названии файла есть пробелы, используйте кавычки:

pscp “C:\files or docs\file name” root@123.123.123.123:/home

Помогла ли вам статья?

Спасибо за оценку. Рады помочь 😊


 👍

Copying files in Windows or Linux is simple enough. Copying files between them, though, not so much. The classic copy-paste with a USB stick method does work, but it’s not very efficient.

Instead, you can transfer files using protocols like SMB and SSH and using FTP applications such as FileZilla. We’ve listed step-by-step instructions for these and more methods in the sections below.

Table of Contents

Ways to Transfer Files between Linux and Windows

Before you start, do keep in mind that, unlike Windows, Linux is case-sensitive. When entering the commands or file paths, users often forget this and can’t figure out why the file transfer doesn’t work despite following the steps correctly.

With that said, here are the various ways to transfer files between Linux and Windows.

Transfer Files Using SMB

The Server Message Block (SMB) protocol is a client-server communication protocol built into most Linux distributions. Here are the steps to transfer files using SMB:

  1. On your Windows system, locate the folder you’re trying to share.
  2. Right-click the folder and select Give access to > Specific People.
    give-access-to-specific-people
  3. Click on Share and press Done on the next screen.
    choose-people-to-share-with
  4. Next, press Win + R, type cmd, and press Enter.
  5. Type ipconfig and press Enter. Note the IPv4 address of the first adapter on the list.
    ipconfig ipv4 address
  6. On the Linux system, launch the File Browser and click on + Other Locations.
  7. In the Connect to Server field, enter the IP from Step 5 in the following format:
    smb://IP
    ubuntu-network-locations-smb-ip
  8. At the authentication prompt, enter your Windows account credentials and press Connect. You can now use this folder to transfer files between Linux and Windows.

Transfer Files Using SSH

Secure Shell Protocol (SSH) is a cryptographic network protocol commonly used for remote login. With an SSH client such as PuTTY, you can transfer files between Linux and Windows via the command line. Here are the steps to do so:

  1. On the Windows system, download and install PuTTY if you haven’t already.
  2. On the Linux system, press CTRL + Alt + T to launch the Terminal.
  3. Install and enable SSH with the following commands on Debian-based Linux systems such as Ubuntu:
    sudo apt install ssh
    sudo systemctl enable ssh --now
  4. On RedHat, CentOS, Fedora, and other systems, use these commands instead:
    sudo apt install OpenSSH
    sudo systemctl enable sshd --now
  5. In case you’re getting blocked by the firewall, use the following command:
    sudo ufw allow 22/tcp
  6. Enter ip addr and note the IP Address.
    ip-addr
  7. On the Windows system, open Command Prompt and use the commands listed below as appropriate.
  8. The following command is to copy a single file. The example shows the file named doc.txt being copied from a remote Linux system to the D drive on the Windows system.
    pscp user@host:remote_path/file_name host_path\file_name
    ssh-pscp-file-transfer-syntax
  9. To copy all files in a folder:
    pscp user@host:remote_path/* host_path\ 
    eg: pscp anup@192.168.10.65:/home/anup/Desktop/naya/* D:\testfolder\ 
  10. To copy all files & folders in a folder:
    pscp -r user@host:remote_path/ host_path\
    eg: pscp -r anup@192.168.10.65:/home/anup/Desktop/naya D:\testfolder\

Transfer Files Using SFTP

You can also use a third-party tool such as FileZilla to transfer files using SFTP (SSH File Transfer Protocol). Here are the steps to do so:

  1. On the Linux system, follow Steps 1 – 6 from the section above to set up SSH.
  2. On the Windows system, launch FileZilla and select File > Site Manager > New Site.
  3. In the Protocol field, select SFTP – SSH File Transfer Protocol.
    filezilla-sftp-ssh
  4. In the Host field, enter the Linux IP Address from Step 6 of the section above.
  5. Fill in the login credentials of your Linux system and press Connect.
  6. If prompted, enable the Always trust this host option and press OK.
  7. Now that the connection is established, you can transfer files between Windows and Linux by dragging and dropping or right-clicking the file and selecting Upload/Download.
    upload-filezilla

You can easily transfer files from Linux to a Windows VM using a USB Stick. Of course, that’s just one easy method. We have an article that details multiple ways to transfer the files for your further reading.

Anup Thapa primarily covers Windows systems, networking, and computer hardware at TechNewsToday. Anup has been writing professionally for almost 5 years, and tinkering with PCs for much longer.
His love for all things tech started when he got his first PC over 15 years ago. It was a Pentium IV system running Windows XP on a single 256 MB stick. He spent his formative years glued to this PC, troubleshooting any hardware or software problems he encountered by himself.
Professionally, Anup has had brief forays into a variety of fields from coding and hardware installation to writing. In doing so, he’s worked with people of different backgrounds and skill levels, from average joes to industry leaders and experts.
This has given him not just a versatile skill set, but also a unique perspective for writing that enables him to concisely communicate complex information and solve his reader’s problems efficiently.
You can reach out to him at anup@technewstoday.com.

  • Psadmin для windows 10 x64 скачать
  • Ps5 remote play скачать windows
  • Ps5 emulator скачать windows 10
  • Ps4 remote play не запускается на windows 10
  • Proliant dl360p gen8 drivers windows server 2019