scp

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


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


Solution

  • 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 your_username@remotehost.edu:/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 your_username@remotehost.edu:/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 your_username@remotehost.edu: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 your_username@remotehost.edu: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