Скопировать файл из linux в windows scp

I am running a putty client on a Windows machine to connect successfully to a Linux box. Now I want to be able to copy a file from the Linux machine under the path /home/ubuntu/myfile to C:/Users/Anshul/Desktop on my local computer. The user at the Windows machine is anshul. I am giving the following command on putty but it is not working:

scp /home/ubuntu/myfile ip_address_of_windows_machine:C:/Users/Anshul/Desktop 

I think the path for the Windows machine is wrong. Please help as I have banged my head on a large number of forums but none seem to give correct path for Windows server. Don’t suggest alternate options like WinScp

Guy Avraham's user avatar

Guy Avraham

3,4923 gold badges38 silver badges51 bronze badges

asked Apr 19, 2012 at 19:56

user1344963's user avatar

5

This one worked for me.

scp /home/ubuntu/myfile username@IP_of_windows_machine:/C:/Users/Anshul/Desktop 

answered Mar 12, 2018 at 6:04

emoblazz's user avatar

emoblazzemoblazz

1,4111 gold badge7 silver badges3 bronze badges

6

Download pscp from Putty download page, then use it from Windows Command Line CMD as follows:

pscp username_linux_machine@ip_of_linux_machine:/home/ubuntu/myfile.ext C:\Users\Name\Downloads

Copying starts once you enter the password for the Linux machine.

ifnotak's user avatar

ifnotak

4,1973 gold badges22 silver badges36 bronze badges

answered Jun 8, 2016 at 20:49

Hesham Eraqi's user avatar

Hesham EraqiHesham Eraqi

2,4524 gold badges23 silver badges45 bronze badges

4

Try this, it really works.

$ scp username@from_host_ip:/home/ubuntu/myfile /cygdrive/c/Users/Anshul/Desktop

And for copying all files

$ scp -r username@from_host_ip:/home/ubuntu/ *. * /cygdrive/c/Users/Anshul/Desktop

fluffyBatman's user avatar

fluffyBatman

6,5443 gold badges24 silver badges25 bronze badges

answered Jun 10, 2014 at 11:57

Chris Alexander sebastian's user avatar

8

Access from Windows by Git Bash console (also works for CMD and PowerShell):

scp user@ip:/dir1/dir2/file "D:\dir1\dir2"

Wenfang Du's user avatar

Wenfang Du

9,03412 gold badges60 silver badges92 bronze badges

answered Jan 4, 2019 at 13:18

byteprom's user avatar

byteprombyteprom

5514 silver badges4 bronze badges

5

You could use something like the following

scp -r linux_username@linux_address:path/to/file path/to/local/directory

This will copy file to the specified local directory on the system you are currently working on.

The -r flag tells scp to recursively copy if the remote file is a directory.

answered Feb 16, 2015 at 23:58

Atif's user avatar

AtifAtif

3451 gold badge4 silver badges16 bronze badges

Windows doesn’t support SSH/SCP/SFTP natively. Are you running an SSH server application on that Windows server? If so, one of the configuration options is probably where the root is, and you would specify paths relative to that root. In any case, check the documentation for the SSH server application you are running in Windows.

Alternatively, use smbclient to push the file to a Windows share.

George's user avatar

George

6,9063 gold badges44 silver badges56 bronze badges

answered Apr 19, 2012 at 19:59

theglauber's user avatar

theglaubertheglauber

28.4k7 gold badges29 silver badges47 bronze badges

5

For all, who has installed GiT completly with «Git Bash»: You can just write:

scp login@ip_addres:/location/to/folders/file.tar .

(with space and DOT at the end to copy to current location). Than just add certificate (y), write password and that’s all.

answered Oct 3, 2017 at 12:31

Krzysztof Walczewski's user avatar

1

Your code isn’t working because c:/ or d:/ is totally wrong for linux just use /mnt/c or/mnt/c

From your local windows10-ubuntu bash use this command:

for download:
(from your remote server folder to d:/ubuntu) :

scp username@ipaddress:/folder/file.txt /mnt/d/ubuntu

Then type your remote server password if there is need.

for upload:
(from d:/ubuntu to remote server ) :

scp /mnt/d/ubuntu/file.txt username@ipaddress:/folder/file.txt 

Then type your remote server password if there is need.
note: I tested and it worked.

answered Feb 19, 2019 at 12:09

Baris Vvolf's user avatar

I had to use pscp like above Hesham’s post once I downloaded and installed putty. I did it to Windows from Linux on Windows so I entered the following:

c:\ssl>pscp username@linuxserver:keenan/ssl/* .

This will copy everything in the keenan/ssl folder to the local folder (.) you performed this command from (c:\ssl). The keenan/ssl will specify the home folder of the username user, for example the full path would be /home/username/keenan/ssl. You can specify a different folder using a forward slash (/), such as

c:\ssl>pscp username@linuxserver:/home/username/keenan/ssl/* .

So you can specify any folder at the root of Linux using :/.

halfer's user avatar

halfer

19.9k17 gold badges102 silver badges189 bronze badges

answered Dec 14, 2018 at 12:47

Keenan Stewart's user avatar

To send a file from windows to linux system

scp path-to-file user@ipaddress:/path-to-destination

Example:

scp C:/Users/adarsh/Desktop/Document.txt [email protected]:/tmp

keep in mind that there need to use forward slash(/) inplace of backward slash(\) in for the file in windows path else it will show an error

C:UsersadarshDesktopDocument.txt: No such file or directory

.
After executing scp command you will ask for password of root user in linux machine.
There you GO…

To send a file from linux to windows system

scp -r user@ipaddress:/path-to-file path-to-destination

Example:

scp -r [email protected]:/tmp/Document.txt C:/Users/adarsh/Desktop/

and provide your linux password.
only one you have to add in this command is -r.
Thanks.

answered Mar 15, 2019 at 6:00

ADARSH K's user avatar

ADARSH KADARSH K

6061 gold badge8 silver badges21 bronze badges

As @Hesham Eraqi suggested, it worked for me in this way (transfering from Ubuntu to Windows (I tried to add a comment in that answer but because of reputation, I couldn’t)):

pscp -v -r -P 53670 [email protected]:/data/genetic_map/sample/P2_283/* \\Desktop-mojbd3n\d\cc_01-1940_data\

where:

-v: show verbose messages.
-r: copy directories recursively.
-P: connect to specified port.
53670: the port number to connect the Ubuntu server.
\\Desktop-mojbd3n\d\genetic_map_data\: I needed to transfer to an external HDD, thus I had to give permissions of sharing to this device.

answered Jun 27, 2019 at 3:37

giannkas's user avatar

giannkasgiannkas

1783 silver badges14 bronze badges

Here is the solution to copy files from Linux to Windows using SCP without password by ssh:

  1. Install sshpass in Linux machine to skip password prompt

  2. Script

    sshpass -p 'xxxxxxx' scp /home/user1/*.* [email protected]:/d/test/

Details:

sshpass -p 'password' scp /source_path/*.* windowsusername@windowsMachine_ip:/destination_drive/subfolder/

serenesat's user avatar

serenesat

4,61110 gold badges37 silver badges53 bronze badges

answered Aug 28, 2015 at 12:47

Ramarajan Jothi's user avatar

Open bash window. Preferably git bash.
write

scp username@remote_ip:/directory_of_file/filename ‘windows_location_you_want_to_store_the_file’

Example:

Suppose your username is jewel

your IP is 176.35.96.32

your remote file location is /usr/local/forme

your filename is logs.zip

and you want to store in your windows PC’s D drive forme folder
then the command will be

scp [email protected]:/usr/local/forme/logs.zip ‘D:/forme’

**Keep the local file directory inside single quote.

answered Apr 7, 2019 at 6:02

Zenith's user avatar

ZenithZenith

1,0571 gold badge10 silver badges21 bronze badges

Try this:

scp /home/ubuntu/myfile C:\users\Anshul\Desktop

Pang's user avatar

Pang

9,622146 gold badges81 silver badges122 bronze badges

answered Jan 12, 2013 at 2:50

Corey Burnett's user avatar

Corey BurnettCorey Burnett

7,31210 gold badges56 silver badges93 bronze badges

1

If you want to copy paste files from Unix to Windows and Windows to Unix just use filezilla with port 22.

answered Sep 4, 2012 at 7:38

user1645422's user avatar

I am running a putty client on a Windows machine to connect successfully to a Linux box. Now I want to be able to copy a file from the Linux machine under the path /home/ubuntu/myfile to C:/Users/Anshul/Desktop on my local computer. The user at the Windows machine is anshul. I am giving the following command on putty but it is not working:

scp /home/ubuntu/myfile ip_address_of_windows_machine:C:/Users/Anshul/Desktop 

I think the path for the Windows machine is wrong. Please help as I have banged my head on a large number of forums but none seem to give correct path for Windows server. Don’t suggest alternate options like WinScp

Guy Avraham's user avatar

Guy Avraham

3,4923 gold badges38 silver badges51 bronze badges

asked Apr 19, 2012 at 19:56

user1344963's user avatar

5

This one worked for me.

scp /home/ubuntu/myfile username@IP_of_windows_machine:/C:/Users/Anshul/Desktop 

answered Mar 12, 2018 at 6:04

emoblazz's user avatar

emoblazzemoblazz

1,4111 gold badge7 silver badges3 bronze badges

6

Download pscp from Putty download page, then use it from Windows Command Line CMD as follows:

pscp username_linux_machine@ip_of_linux_machine:/home/ubuntu/myfile.ext C:\Users\Name\Downloads

Copying starts once you enter the password for the Linux machine.

ifnotak's user avatar

ifnotak

4,1973 gold badges22 silver badges36 bronze badges

answered Jun 8, 2016 at 20:49

Hesham Eraqi's user avatar

Hesham EraqiHesham Eraqi

2,4524 gold badges23 silver badges45 bronze badges

4

Try this, it really works.

$ scp username@from_host_ip:/home/ubuntu/myfile /cygdrive/c/Users/Anshul/Desktop

And for copying all files

$ scp -r username@from_host_ip:/home/ubuntu/ *. * /cygdrive/c/Users/Anshul/Desktop

fluffyBatman's user avatar

fluffyBatman

6,5443 gold badges24 silver badges25 bronze badges

answered Jun 10, 2014 at 11:57

Chris Alexander sebastian's user avatar

8

Access from Windows by Git Bash console (also works for CMD and PowerShell):

scp user@ip:/dir1/dir2/file "D:\dir1\dir2"

Wenfang Du's user avatar

Wenfang Du

9,03412 gold badges60 silver badges92 bronze badges

answered Jan 4, 2019 at 13:18

byteprom's user avatar

byteprombyteprom

5514 silver badges4 bronze badges

5

You could use something like the following

scp -r linux_username@linux_address:path/to/file path/to/local/directory

This will copy file to the specified local directory on the system you are currently working on.

The -r flag tells scp to recursively copy if the remote file is a directory.

answered Feb 16, 2015 at 23:58

Atif's user avatar

AtifAtif

3451 gold badge4 silver badges16 bronze badges

Windows doesn’t support SSH/SCP/SFTP natively. Are you running an SSH server application on that Windows server? If so, one of the configuration options is probably where the root is, and you would specify paths relative to that root. In any case, check the documentation for the SSH server application you are running in Windows.

Alternatively, use smbclient to push the file to a Windows share.

George's user avatar

George

6,9063 gold badges44 silver badges56 bronze badges

answered Apr 19, 2012 at 19:59

theglauber's user avatar

theglaubertheglauber

28.4k7 gold badges29 silver badges47 bronze badges

5

For all, who has installed GiT completly with «Git Bash»: You can just write:

scp login@ip_addres:/location/to/folders/file.tar .

(with space and DOT at the end to copy to current location). Than just add certificate (y), write password and that’s all.

answered Oct 3, 2017 at 12:31

Krzysztof Walczewski's user avatar

1

Your code isn’t working because c:/ or d:/ is totally wrong for linux just use /mnt/c or/mnt/c

From your local windows10-ubuntu bash use this command:

for download:
(from your remote server folder to d:/ubuntu) :

scp username@ipaddress:/folder/file.txt /mnt/d/ubuntu

Then type your remote server password if there is need.

for upload:
(from d:/ubuntu to remote server ) :

scp /mnt/d/ubuntu/file.txt username@ipaddress:/folder/file.txt 

Then type your remote server password if there is need.
note: I tested and it worked.

answered Feb 19, 2019 at 12:09

Baris Vvolf's user avatar

I had to use pscp like above Hesham’s post once I downloaded and installed putty. I did it to Windows from Linux on Windows so I entered the following:

c:\ssl>pscp username@linuxserver:keenan/ssl/* .

This will copy everything in the keenan/ssl folder to the local folder (.) you performed this command from (c:\ssl). The keenan/ssl will specify the home folder of the username user, for example the full path would be /home/username/keenan/ssl. You can specify a different folder using a forward slash (/), such as

c:\ssl>pscp username@linuxserver:/home/username/keenan/ssl/* .

So you can specify any folder at the root of Linux using :/.

halfer's user avatar

halfer

19.9k17 gold badges102 silver badges189 bronze badges

answered Dec 14, 2018 at 12:47

Keenan Stewart's user avatar

To send a file from windows to linux system

scp path-to-file user@ipaddress:/path-to-destination

Example:

scp C:/Users/adarsh/Desktop/Document.txt [email protected]:/tmp

keep in mind that there need to use forward slash(/) inplace of backward slash(\) in for the file in windows path else it will show an error

C:UsersadarshDesktopDocument.txt: No such file or directory

.
After executing scp command you will ask for password of root user in linux machine.
There you GO…

To send a file from linux to windows system

scp -r user@ipaddress:/path-to-file path-to-destination

Example:

scp -r [email protected]:/tmp/Document.txt C:/Users/adarsh/Desktop/

and provide your linux password.
only one you have to add in this command is -r.
Thanks.

answered Mar 15, 2019 at 6:00

ADARSH K's user avatar

ADARSH KADARSH K

6061 gold badge8 silver badges21 bronze badges

As @Hesham Eraqi suggested, it worked for me in this way (transfering from Ubuntu to Windows (I tried to add a comment in that answer but because of reputation, I couldn’t)):

pscp -v -r -P 53670 [email protected]:/data/genetic_map/sample/P2_283/* \\Desktop-mojbd3n\d\cc_01-1940_data\

where:

-v: show verbose messages.
-r: copy directories recursively.
-P: connect to specified port.
53670: the port number to connect the Ubuntu server.
\\Desktop-mojbd3n\d\genetic_map_data\: I needed to transfer to an external HDD, thus I had to give permissions of sharing to this device.

answered Jun 27, 2019 at 3:37

giannkas's user avatar

giannkasgiannkas

1783 silver badges14 bronze badges

Here is the solution to copy files from Linux to Windows using SCP without password by ssh:

  1. Install sshpass in Linux machine to skip password prompt

  2. Script

    sshpass -p 'xxxxxxx' scp /home/user1/*.* [email protected]:/d/test/

Details:

sshpass -p 'password' scp /source_path/*.* windowsusername@windowsMachine_ip:/destination_drive/subfolder/

serenesat's user avatar

serenesat

4,61110 gold badges37 silver badges53 bronze badges

answered Aug 28, 2015 at 12:47

Ramarajan Jothi's user avatar

Open bash window. Preferably git bash.
write

scp username@remote_ip:/directory_of_file/filename ‘windows_location_you_want_to_store_the_file’

Example:

Suppose your username is jewel

your IP is 176.35.96.32

your remote file location is /usr/local/forme

your filename is logs.zip

and you want to store in your windows PC’s D drive forme folder
then the command will be

scp [email protected]:/usr/local/forme/logs.zip ‘D:/forme’

**Keep the local file directory inside single quote.

answered Apr 7, 2019 at 6:02

Zenith's user avatar

ZenithZenith

1,0571 gold badge10 silver badges21 bronze badges

Try this:

scp /home/ubuntu/myfile C:\users\Anshul\Desktop

Pang's user avatar

Pang

9,622146 gold badges81 silver badges122 bronze badges

answered Jan 12, 2013 at 2:50

Corey Burnett's user avatar

Corey BurnettCorey Burnett

7,31210 gold badges56 silver badges93 bronze badges

1

If you want to copy paste files from Unix to Windows and Windows to Unix just use filezilla with port 22.

answered Sep 4, 2012 at 7:38

user1645422's user avatar

Secure data transfer via SCP

In the last article I showed you how to transfer data to a Ubuntu system via FTP. Nowadays FTP is not secure enough for internet use. Therefore I will show you SCP today. SCP is based on the SSH protocol. Therefore you need a user who can also access the server via SSH. As with SSH, you can use SSH keys to establish SCP connections. How to create SSH keys and store them on your server is shown in this article. 
Since Linux servers can also be managed from a Windows client, I will also show you the free program WinSCP in the course of this article, with which you can also transfer data from Windows to Linux servers via SCP.

Prepare Server

Since SCP or SSH as a client is a fixed part of every Linux distribution, you don’t need any further preparation on the client side. On the server side, depending on the distribution, you may need to install the SSH server service.
As before any installation, you should update your server to the latest version. For operating systems based on Debian (such as Ubuntu or Kubuntu), use the following command:

Copyapt -y update && apt -y upgrade && apt -y dist-upgrade

For CentOS or Red Hat or similar distributions YUM is used as package manager. Therefore, the command is as follows:

Copyyum update

To update your Fedora system, use the following command.

Copydnf update && dnf upgrade

Then start the installation with the following command:

Debian / Ubuntu

Copyapt -y install openssh-server

CentOS / RHEL

Copyyum install openssh-server

Fedora

Copydnf install openssh-server

Establishing a SSH connection

To test if the setup was successful, connect to your server via SSH. Open a terminal from your Linux or Apple client and execute the following command:

Copyssh <username>@<IPorDomainofServer>

Example:

Copyssh root@10.10.0.12

If you are using an SSH key, enter the password for your key now. Otherwise, the password for the user on the remote computer must be specified.

If everything is set up, the console of the remote computer should now be visible. If not, check your firewall settings. SSH requires port 22/tcp. You can also check the config of the SSH server and make sure that your user has the appropriate permissions.

Once you have successfully established the connection, you can close it again. Simply enter the command exit.

Copyexit

Transfer a file via SCP

For testing purposes, it is best to create a test file.

Copytouch /test.file

To transfer the file test.file to the other server use the following command:

Copyscp /path/to/file <benutzername>@<IPorDomainofServer>:/Path/to/destionationfolder/

Example:

Copyscp /test.file root@10.10.0.12:/root/secret/test.file

The file is now transferred to /root/secret on the server with IP 10.10.0.12.

If you want to download a file from a remote computer, you can also use SCP. The structure of the command has to be reversed.

Copyscp <username>@<IPorDomainofServer>:/Path/to/file/destination/path

Example:

Copyscp root@10.10.0.12:/root/secret/test.file /root/lokalsecrets/test.file

Make sure that the directories already exist.

You can also use SCP to transfer files from one server to another, from your client.

The syntax will look like this.

Copyscp <username>@<IPorDomainofServer>:/path/to/file <username>@<IPorDomainofServer>:/Path/to/destination

Example:

Copyscp root@10.10.0.12:/test.datei root@10.10.0.13/root/secret/test.file

If you use Windows 10 as client (from version 16.07) you can install the Linux subsystem and get a Ubuntu Bash including APT. With this you can use the syntax already shown.

Right-click “Start”, then on “Programs and Features” or for version 1703 “Apps and Features” and then on “Programs and Features”, then on “Activate or deactivate Windows features”. In the now open window, look for “Windows subsystem for Linux (beta)”. Afterwards the developer mode must be activated under Start -> Settings -> Update and security -> For developers. After the installation run cmd and type the command bash.

bash

Then confirm the installation with Y and type in a user name and password after a short wait.

If you are using an older version of Windows, you can take a look at the WinSCP program. You can find the current release here.

The setup of the tool is quite simple. Select Total Commander mode during installation. So on the left side of the window you will see your Local Folder Structure and on the right side the one of the server you have connected to. Files can be moved back and forth via Drag ‘n Drop and renamed, executed or deleted with a right click.

Conclusion

SCP is fairly quick to learn and reliably transmits even large amounts of data securely over the Internet. SCP is unfortunately very Linux-heavy – that means – Windows as client is no problem, but as soon as you use Windows as server, it becomes very difficult. As an alternative you can use WebDAV for example. I’ll show you how this works in this article. So if you work with different operating systems, you should take a look at both techniques.

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

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

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


 👍

  • Скорость скачивания низкая windows 10
  • Скриншот выбранной области экрана windows 10
  • Скопировать файл в директорию windows
  • Сколько стоит установить лицензионный windows 10 на компьютер
  • Скорость сети на панели задач windows 11