LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Networking (http://www.linuxquestions.org/questions/linux-networking-3/)
-   -   Why won't 'scp' let me copy to a remote computer? (http://www.linuxquestions.org/questions/linux-networking-3/why-wont-scp-let-me-copy-to-a-remote-computer-674030/)

otter2244 10-03-2008 03:37 PM

Why won't 'scp' let me copy to a remote computer?
 
I am trying to copy files from my computer to a remote computer on campus.

I tried using
Code:

scp <local file> <username>@<host>:<remote directory>
But I keep getting a <local file>: No such file or directory error.

Can anyone tell me what I am doing wrong?

colucix 10-03-2008 03:41 PM

Silly question: are you sure the path of the local file is correct? Is it in the current/working directory?

otter2244 10-03-2008 03:45 PM

I'm really not sure. How would I check to make sure that I'm in the working directory?

And I am extremely new to command line arguments so what is the corrent way to put in the filename? I have been entering it like this C:\dir\dir\file.txt?

colucix 10-03-2008 03:49 PM

The working directory is the directory you are inside when you launch the scp command. You can check its absolute path using the pwd command. Then you can simply list the content of the directory to see if the <local file> is actually there, using the ls command. The syntax of the scp command is correct.

Edit: to answer to the last part of your question, you can enter the filename simply by its name (if it is in the current/working directory), by its absolute path (like /path/to/some/directory/file.txt) or by a relative path (like ../file.txt where .. is the upper directory in respect of the current one).

rossonieri#1 10-03-2008 03:51 PM

hi otter,

try to change this line :
Quote:

scp <local file> <username>@<host>:<remote directory>
to this :
Quote:

scp <local_filename> <username>@<host>:<remote_filename>
file names are something like file.txt or file.png and so forth (without directory path - you have to be in the same directory with the file).

HTH.

otter2244 10-03-2008 04:00 PM

I tried using the absolute path and it gave another error saying
"ssh: C: Name or service not known"

colucix 10-03-2008 04:53 PM

Well, you're using a Windows style path name. Which system you're running on? In Linux/Unix the absolute paths are something like
Code:

/home/otter/file.txt
that is you have to use the normal slash and you don't have to specify the device name, as C: in Windows. The root of the directory tree is simply / and all the disks or partitions are mounted somewhere under the root.

Please, describe where is the file you're trying to copy: is it on the desktop? Then try the commands pwd and ls and post the results here, if you think they are relevant to solve the issue.

rozilla 10-05-2008 06:01 PM

Quote:

Originally Posted by otter2244 (Post 3299379)
I'm really not sure. How would I check to make sure that I'm in the working directory?

And I am extremely new to command line arguments so what is the corrent way to put in the filename? I have been entering it like this C:\dir\dir\file.txt?

You might be messing up the path name. Try this:

1. Type pwd and look at the output. It tells you what directory you're in. pwd stands for "print working directory".

2. Type ls or ls -al to see if your file is in the current directory.

3. Let's assume it is in this directory and it's a file called tracklist.txt, and you want to scp it to a server with the IP of 123.45.67.890.

4. Type this

Quote:

scp tracklist.txt otter@123.45.67.890:
The above copies tracklist.txt to your home directory on the server with the IP 123.45.67.890
Note that you need to have an account on said remote server in order for you to be able to scp to it. (scp means "secure copy").

5. If you want to copy to a specific directory on the remote server other than just the home directory, then include the path name at the end of the above mentioned command:

scp tracklist.txt otter@123.45.67.890:/home/otter/some-other-directory


Remember, if you don't have an account on the destination server, then you won't be able to copy.


All times are GMT -5. The time now is 11:29 AM.