LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices

Reply
 
Search this Thread
Old 10-03-2008, 04:37 PM   #1
otter2244
LQ Newbie
 
Registered: Oct 2008
Posts: 3

Rep: Reputation: 0
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?
 
Old 10-03-2008, 04:41 PM   #2
colucix
Moderator
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957
Silly question: are you sure the path of the local file is correct? Is it in the current/working directory?
 
Old 10-03-2008, 04:45 PM   #3
otter2244
LQ Newbie
 
Registered: Oct 2008
Posts: 3

Original Poster
Rep: Reputation: 0
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?
 
Old 10-03-2008, 04:49 PM   #4
colucix
Moderator
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957
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).

Last edited by colucix; 10-03-2008 at 04:53 PM.
 
Old 10-03-2008, 04:51 PM   #5
rossonieri#1
Member
 
Registered: Jun 2007
Posts: 359

Rep: Reputation: 34
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.
 
Old 10-03-2008, 05:00 PM   #6
otter2244
LQ Newbie
 
Registered: Oct 2008
Posts: 3

Original Poster
Rep: Reputation: 0
I tried using the absolute path and it gave another error saying
"ssh: C: Name or service not known"
 
Old 10-03-2008, 05:53 PM   #7
colucix
Moderator
 
Registered: Sep 2003
Location: Bologna
Distribution: CentOS 6.5 OpenSuSE 12.3
Posts: 10,509

Rep: Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957Reputation: 1957
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.
 
Old 10-05-2008, 07:01 PM   #8
rozilla
Member
 
Registered: Dec 2006
Distribution: Ubuntu 8.04
Posts: 72

Rep: Reputation: 15
Quote:
Originally Posted by otter2244 View Post
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.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
SCP: Copy file from remote linux server onto a windows machine? Tony Empire Linux - Newbie 19 06-04-2013 06:13 AM
scp: copy a file from local machine to remote machine seran Linux - Newbie 8 10-30-2007 01:23 PM
scp/ssh tail(multiple file) remote copy tpreitano Linux - General 1 08-22-2005 03:17 PM
copy files....using scp help me suguname Mandriva 2 01-26-2005 02:14 AM
scp :copy file from one remote comp to another aniketh Linux - Networking 4 06-16-2004 03:31 AM


All times are GMT -5. The time now is 10:31 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration