Scp no such file or directory ошибка

Обновлено: 01.07.2024

But when I try to do remote to local it says no such file or directory:

When i try scp pi@192.168.2.11:/home/pi/image.jpg

it asks for my remote password and shows that the transfer went through, but i can't find the file on my local machine.

This is where I am now:

step 1 - ssh into remote host

step 2 - sudo scp pi@192.168.2.11:image.jpg

which gives this response: pi@192.168.2.11's password:

step 3 - i enter the correct password which gives this: image.jpg 100% 163KB 162.7KB/s 00:00

step 4 - on local machine i do cd

followed by ls | grep image.jpg which does not give any output just a new command line

131 1 1 gold badge 1 1 silver badge 3 3 bronze badges The general syntax is: scp source[s] target . So try: scp

2 Answers 2

You have a pretty fundamental mis-understanding of how scp works.

Assuming "local" is where you want the file to end up, and "remote" is where the file is now, do this:

can be replaced with where ever you want the file to go on local.

DO NOT ssh to remote first. When you ssh to remote then run that command you are effectively copy the file from remote to remote, which is not what you want.

Do what you are doing, but skip step 1. Run the scp from bash/terminal on your local machine, don't ssh to remote first.

I want to be able to transfer a directory and all its files from my local machine to my remote one. I dont use SCP much so I am a bit confused.

I am connected to my remote machine via ssh and I typed in the command

scp name127.0.0.1:local/machine/path/to/directory filename

the local/machine/path/to/directory is the value i got from using pwd in the desired directory on my local host.

I am currently getting the error

No such file or directory

13.9k 40 40 gold badges 129 129 silver badges 226 226 bronze badges Your mistake is where you have connected to the remote machine and then typed the command. You should run the command from your own system in the directory where the file exist not when you have connected..

10 Answers 10

Looks like you are trying to copy to a local machine with that command.

An example scp looks more like the command below:

Copy the file "foobar.txt" from the local host to a remote host

scp "the_file" your_username@the_remote_host:the/path/to/the/directory

to send a directory:

Copy the directory "foo" from the local host to a remote host's directory "bar"

scp -r "the_directory_to_copy" your_username@the_remote_host:the/path/to/the/directory/to/copy/to

and to copy from remote host to local:

Copy the file "foobar.txt" from a remote host to the local host

scp your_username@the_remote_host:the_file /your/local/directory

and to include port number:

Copy the file "foobar.txt" from a remote host with port 8080 to the local host

scp -P port_number your_username@the_remote_host:the_file /your/local/directory

From a windows machine to linux machine using putty

pscp -r <directory_to_copy> username@remotehost:/path/to/directory/on/remote/host


5,694 2 2 gold badges 27 27 silver badges 37 37 bronze badges In case you need to explicitly specify port number do it by using -P portNumber. e.g.` scp -P 2200 bprajapati@192.168.202.124:/tmp/bs-404

i had a kind of similar problem. i tried to copy from a server to my desktop and always got the same message for the local path. the problem was, i already was logged in to my server per ssh, so it was searching for the local path in the server path.

solution: i had to log out and run the command again and it worked

In my case I had to specify the Port Number using


788 1 1 gold badge 14 14 silver badges 30 30 bronze badges

Your problem can be caused by different things. I will provide you three possible scenarios in Linux:

When you use scp name , you mean that your File name is in Home directory. When it is in Home but inside in another Folder, for example, my_folder, you should write:

You must know the File Permission your File has. If you have Read-only you should change it.

To change the Permission:

As Root , sudo caja ( the default file manager for the MATE Desktop) or another file manager ,then with you Mouse , right-click to the File name , select Properties + Permissions and change it on Group and Other to Read and write .

Maybe you remote machine or Server can only communicate with a Port Number, so you should write -P and the Port Number.

Я пытаюсь скопировать файлы с моего ноутбука на хост с помощью команды ssh:

$ scp /home/roberto/Metagenoma_MEL_COLS/Mix-MEL_S10_L002_R1_001.fastq.tar.gz roberto@xxxx.xxx.xxx.es:/media/disk7/roberto/

, и он показывает:

/home/roberto/Metagenoma_MEL_COLS/Mix-MEL_S10_L002_R1_001.fastq.tar.gz: No such file or directory

Вывод ls -lsa is:

$ ls -lsa /home/roberto/Metagenoma_MEL_COLS/Mix-MEL_S10_L002_R1_001.fa‌​stq.tar.gz 3268104 -rw------- 1 roberto roberto 3346533319 abr 27 07:01 /home/roberto/Metagenoma_MEL_COLS/Mix-MEL_S10_L002_R1_001.fa‌​stq.tar.gz

Как я могу его решить?

4 ответа

Кажется, вы запускаете команду scp с сервера, но вы должны выпустить ее со своего ноутбука:

$ scp /home/roberto/Metagenoma_MEL_COLS/Mix-MEL_S10_L002_R1_001.fastq.tar.gz roberto@xxxx.xxx.xxx.es:/media/disk7/roberto/

$ scp /home/roberto/Metagenoma_MEL_COLS/Mix-MEL_S10_L002_R1_001.fastq.tar.gz roberto@xxxx.xxx.xxx.es:/media/disk7/roberto/

с сервера вы можете запустить следующее, но брандмауэр / маршрутизатор может помешать этому.


No Such File Or Directory Error

In this article, we will discuss some of the reasons due to which this issue is triggered and also provide viable solutions to fix it completely. Also, we will look into some of the reasons due to which it is triggered. Make sure to follow the guide carefully and accurately to avoid conflict.

After receiving numerous reports from multiple users, we decided to investigate the issue and devised a set of solutions to fix it completely. Also, we looked into the reasons due to which it is triggered and listed them as follows.

Now that you have a basic understanding of the nature of the problem, we will move on towards the solutions. Make sure to implement these in the specific order in which they are presented to avoid conflict.

Solution 1: Using Correct Commands

You must use the correct command depending upon the configuration of hosts between which you want to transfer the files. For this, we will be listing some of the commands that can be used to transfer files between different host configurations.

To Copy From Local Host to Remote Host

In the same way, you can copy a whole directory in the following way

To Copy From Remote Host to Local Host

If you wish to copy a file from the Remote Host to a Local Host, the command configurations differ from the original ones. Below are indicated the appropriate commands to copy files between a Remote Host and a Localhost.

To copy a File, use the following command

Solution 2: Identifying Port Number

The Port Number of the remote host must be identified before copying the file to the computer. For that, we will be adding the port number while initiating the copying process.

You can use the following command to copy between computers while indicating the port number.

Solution 3: Changing Permissions

Читайте также: