Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

scp files from local to remote machine error: no such file or directory

Tags:

scp

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

like image 384
Liondancer Avatar asked Oct 13 '14 18:10

Liondancer


People also ask

How do I SCP a directory from local to remote?

Copy a Local File to a Remote System with the scp Command 0.2 is the server IP address. The /remote/directory is the path to the directory you want to copy the file to. If you don't specify a remote directory, the file will be copied to the remote user home directory.

Why SCP command is not working?

When SCP tries to SSH into your server, if you don't have a part of your . bashrc file that allows non-interactive connections, it will attempt to echo out any commands you have load at the initial connection of your SSH session. This commands that echo their output unfortunately break SCP.

Why is there no such file or directory?

log No such file or directory” the problem is most likely on the client side. In most cases, this simply indicates that the file or folder specified was a top-level item selected in the backup schedule and it did not exist at the time the backup ran.

Is a directory SCP error?

SCP doesn't automatically create you new directory if you want to scp file (it creates directory only if you do recursive copy). There is wrong error message. The error should be No such file or directory or similar. It is known problem and there is upstream bugzilla about this [1].


2 Answers

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 foobar.txt [email protected]:/some/remote/directory 

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 foo [email protected]:/some/remote/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 [email protected]:foobar.txt /your/local/directory 

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 8080 [email protected]:foobar.txt /your/local/directory 

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

like image 76
Craicerjack Avatar answered Oct 03 '22 00:10

Craicerjack


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

like image 29
Dominik Herrmann Avatar answered Oct 03 '22 02:10

Dominik Herrmann