- No Such File Or Directory In SCP: How To Fix The Error [MiniTool News]
- Summary :
- No Such File or Directory in SCP
- Causes of No Such File or Directory Error
- How to Fix Secure Copy Protocol Error
- ABOUT THE AUTHOR
- How to Fix ‘No such File or Directory’ Error in SCP?
- What Causes the “No Such File or Directory” Error in SCP?
- Solution 1: Using Correct Commands
- To Copy From Local Host to Remote Host
- To Copy From Remote Host to Local Host
- Solution 2: Identifying Port Number
- Solution 3: Changing Permissions
- «No such file or directory» error when attempting to copy (using scp) from remote host to local machine
- 1 Answer 1
- Не копируются файлы через SSH
- windows?
No Such File Or Directory In SCP: How To Fix The Error [MiniTool News]
By Sarah | Follow | Last Updated November 30, 2020
Summary :
Are you familiar with the error — No such file or directory? Probably you will say yes, right? But do you know what does it mean in SCP? If not, you should read the following content carefully since it introduces the causes of No such file or directory error in SCP and the corresponding measures you should take to solve the problem yourself.
You may see the No such file or directory error now and then in different problems. Here in this article, I will mainly talk about the No such file or directory error in Secure Copy Protocol. What triggers this SCP error? How to fix it in different ways without others’ help? All these questions will be answered below.
Please pay much attention to MiniTool Solution since it is professional in storage management and problem solving.
No Such File or Directory in SCP
First of all, I’d like to explain what SCP is. As the acronym of Secure Copy Protocol, the SCP refers to a security file transfer protocol between a local host and a remote host or among different remote hosts. SCP is developed on the basis of Secure Shell (SSH) protocol and used to help people transfer files among different devices. The SCP has many in common with FTP (File Transfer Protocol) except that the former adds security and authentication.
However, a lot of people reported recently that come across SCP no such file or directory error when they are trying to copy files with the program. Noticing this, I decide to list some of the common reasons that cause the SCP error and the corresponding solutions to fix it.
Causes of No Such File or Directory Error
There are mainly 4 reasons that should be responsible for the Secure Copy Protocol — no such file or directory.
- Port number is not specified: the user didn’t specify the certain port number before they copy files between devices. To complete the file copying process successfully, you must forward correct port in advance.
- File permissions settings are not correct: if the permission of a file is set to read-only, it means you can only access the file and look for information you need. You are not allowed to copy or move it unless the Read and Write permissions are offered for the file.
- Login is not correct: the SCP error could occur when you are trying to copy files to certain desktop after you have logged into the server. Why? That’s because the server will try to find the local path within it. In this case, you should log out of the server path to solve the problem.
- Command is not correct: if the command you’re using to copy files between devices is not correct, you will encounter no such file or directory. You should go to modify the command to make it correct. Please remember that the command used to copy a certain file is not the same as that used to copy a whole directory.
How to Fix Secure Copy Protocol Error
* 1: identify the port number correctly.
If you’re not sure about the port number, you should use this command to copy files between devices since it can indicate the port number:
$ scp -P port_number [email protected]_remote_host:the_file /your/local/directory
It can be used to indicate port number when you are trying to copy files to a remote host (or from it).
* 2: check and modify permissions.
As said earlier, you must make sure that enough permission is provided to the file you’re copying so as to avoid the Secure Copy Protocol error. So you should do the following things:
- Open File Explorer and navigate to the file you want to copy.
- Right click on the file and choose Properties.
- Uncheck the Read-only option under General tab.
- Click on the Apply button to confirm.
- Shift to the Security tab and check whether all the permissions are provided to the System and Administrator.
* 3: make sure the command you’re going to use is correct.
Here are some of the most commonly used commands for copying files.
Copy files from local host to remote host:
- $ scp «the_file» [email protected]_remote_host:the/path/to/the/directory (copy a file)
- $ scp name.txt [email protected]:/some/remote/directory (copy a file)
- $ scp -r «the_directory_to_copy» [email protected]_remote_host:the/path/to/the/directory/to/copy/to (copy a whole directory)
- $ scp -r foo [email protected]:/some/remote/directory/bar (copy a whole directory)
Copy files from remote host to local host:
- $ scp [email protected]_remote_host:the_file /your/local/directory
- $ scp [email protected]_remote_host:name.txt /your/local/directory
That’s it. Do you know how to cope with no such file or directory now?
ABOUT THE AUTHOR
Position: Columnist
Sarah is working as editor at MiniTool since she was graduated from university, having rich writing experiences. Love to help other people out from computer problems, disk issues, and data loss dilemma and specialize in these things. She said it’s a wonderful thing to see people solving their problems on PC, mobile photos, and other devices; it’s a sense of accomplishment. Sarah likes to make friends in life and she’s a huge music fan.
Источник
How to Fix ‘No such File or Directory’ Error in SCP?
SCP stands for Secure Copy Protocol and it is based on the “Secure Shell” protocol. It provides a method for transferring files between computers. In this transfer, either both the computers can be remote hosts or one computer can be a localhost and the other, a remote host. Quite recently, a lot of users have been getting the “No Such File or Directory” Error while trying to copy files with SCP.
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.
What Causes the “No Such File or Directory” Error in SCP?
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.
- Incorrect Command: In some cases, the command that is being used by the user to copy the file might not be correct. You must modify the copy command to fit the current situation in which you are copying. The commands for copying files and a whole directory are different. Also, the command to copy between two computers with different configurations is changed as per the requirements.
- Port Number: It is also possible that the port number for copying files between computers hasn’t been specified. The correct port must be forwarded before trying to copy files between two hosts.
- Incorrect Login: If you are currently logged into the server and are trying to copy the files to a desktop, you might experience this error because the server tries to find the local path within the server. This can be prevented by logging out of the server path.
- File Permissions: In some cases, the permissions of the files that are to be copied might be limited to “Read-Only”. This can prevent the server from accessing the files and from being able to copy them. It is important the Read and Write permissions are provided for the files.
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
The Localhost is the actual computer to which you have physical access. The Remote Host is the one to which the user doesn’t have any physical access and it is located in a distant server. To transfer files from a Localhost to a Remote Host, you have to use the following command configurations.
An example to copy a text file named “Alexa.txt” will be as follows.
In the same way, you can copy a whole directory in the following way
An example to copy a directory named “Alexa” would be as follows.
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
To copy a file named “Alexa.txt“, use the following commands
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.
This same command can be used to indicate the port number while copying to or from a remote host. You just need to add the “-P (Port number)” after the “$ scp ” portion of the command.
Solution 3: Changing Permissions
The appropriate permissions must be provided to the file while copying them between computers. Therefore, in this step, we will be indicating the process to change a file’s permissions. For that:
- Right–click on the file that you are trying to copy.
- Click on “Properties” and select the “Security” tab.
Clicking on “Properties”
- Make sure that all the permissions are provided to the “System” and the “Administrator“.
Clicking on “Allow” for all Permissions
Note: Also, make sure that you don’t log in to the server path while copying the files.
Источник
«No such file or directory» error when attempting to copy (using scp) from remote host to local machine
I am attempting to copy a file (/home4/user/public_html/website.com/folder_1/folder_2/file_to_copy.zip) from my remote host to my local machine’s desktop (/Users/username/Desktop) using the scp command.
In order to accomplish this I run iTerm on my Mac and use the following command:
(It might also be worth noting that I am logged in via ssh to my remote host as I try to execute this command.)
When I run the command I am prompted to fill in the password for user@remotehost.com (which I do) and then I receive the following error message:
/Users/username/Desktop: No such file or directory
Similarly, I have been unable to use scp to copy files to my remote host.
Any help with this issue is highly appreciated, and I hope that I can receive simple/thorough explanations as I am completely new to using a command line and ssh.
1 Answer 1
scp does not require that you SSH to the remote computer in order to make the copy (and this is where you’re currently running into trouble with your command).
scp essentially works in either a push or pull fashion. You can push files/folders from your local PC to a remote. The command syntax for this method is as follows:
Which will prompt you for the password of user on remotehost .
You can also pull file/folders from a remote PC to your local PC. The command syntax for this method is as follows:
Which will also prompt you for the password to user on remotehost .
The problem you were running into with your command above is that you were using the data pull syntax of the scp command in order to grab a file from a remotehost, but you were also SSH’d into that remotehost while running it.
The correct way to run this command is to run it from your local machine
**Note that I removed the superfluous -r from your original command. It’s not something that will throw off an error, but it’s just that it’s not necessary in your case. The -r option of scp is to be used when recursively copying a folder and all its contents. In your case you were just copying a file so it wasn’t necessary.
**I also added the -P 2222 since subsequent comments from you indicated that you needed to use port 2222 instead of standard port 22.
Источник
Не копируются файлы через SSH
Всем доброго времени суток. Не хочет работать копирование файлов через SSH с Windows 8.1 на Debian 8. На Windwos 8.1 использую Putty:
Выдается такая ошибка:
windows?
try /d/file.tmp instead of d:/file.tmp
Качай с сайта, где брал putty, файлик pscp.exe (например тут) и делай это через нее.
pscp.exe -scp -P 2234 file.tmp -l petabyte QWERTY1:/home/petabyte/Downloads/
scp Вы запускаете где ? На удаленном хосте ?
Ну так оно и не будет работать. Хотя, если Вы на своем Windows 8.1 запустите SSH сервер.
Так не копируется, пишет No such file or directory, хотя файл есть.
scp Вы запускаете где ? На удаленном хосте ?
Ну так оно и не будет работать.
Запускаю на ПК с Windows 8.1. Подскажите, как копировать файлы с Wkndows на Debian SSH можно? Какие есть способы? Я прогуглил, нашел только тот, кторый в 1 — ом посте данной темы.
рановато тебе в консоль. попробуй WinSCP
Запускаю на ПК с Windows 8.1. Подскажите, как копировать файлы с Wkndows на Debian SSH можно? Какие есть способы? Я прогуглил, нашел только тот, кторый в 1 — ом посте данной темы.
Источник