up vote 1 down vote favorite
1
share [g+] share [fb]

I am trying to copy a file from my other computer, to another computer. (both running Ubuntu 9.10)

So say:

I've ssh'ed into the other computer; i 'cd' to the directory; and i entered cp File.zip /home/me/Desktop as file.zip is located in the directory i just used cd with.

Now, it gives me the following error message: cannot create regular file '/home/me/Desktop': no such file or directory

What do i have to do?

link|improve this question

79% accept rate
feedback

migrated from stackoverflow.com Jan 6 '10 at 17:51

This question came from our site for professional and enthusiast programmers.

4 Answers

This isn't really programming related, but you can use scp to do this.

scp file.zip remote-box-name:/path/to/destination/file.zip

If your username is different on the remote box, you will need to prefix it:

scp file.zip yourusername@remotebox:/path/to/destination/file.zip
link|improve this answer
how does that work when i am sshed into the other computer on the computer where i want to copy the file to? Because when i try like scp file.zip me@xxx.xxx.xx.xxx:/home/me/Desktop, it says 'connection refused', probably because it is the computer im on. How to? – TutorialPoint Jan 6 '10 at 18:15
The syntax is src_file dest_file, where either can be just a filename on a local computer (file.zip), or a remote file (me@xxx.xxx.xx.xxx:/home/me/Desktop). So if you want to pull a files from a remote machine to the local machine, you would do scp xxx.xxx.xx.xxx:/home/me/Desktop/file.zip file.zip. Note that local and remote are relative to the machine you are running the scp. So if you are on machine A, ssh to machine B and do an scp, B is local and A is remote. – KeithB Jan 6 '10 at 18:23
It still gives the same error as i shown in the question – TutorialPoint Jan 6 '10 at 18:34
when i try to do it from local machine, it says 'no route to host' or something like that... probably because it is protected with a password. – TutorialPoint Jan 6 '10 at 18:38
sftp is another good option if you're comfortable with ftp and are doing this manually. – Brian Knoblauch Jan 6 '10 at 20:08
show 1 more comment
feedback
  1. On machine A, open two terminal windows

  2. On machine A, ssh to machine B. Look around, find the path on machine B to the file you wish to copy

  3. On machine A, the second terminal window type:

scp yourusername@remotebox:/path/to/destination/file.zip /home/me/Desktop

The file should be copied from machine B to machine A, in to the /home/me/Desktop folder (if the folder exists on Machine A

You can't copy over the existing ssh session. You need to create a second session. As others have noted:

  • yourusername is for Machine B, and is only needed if the username for Machine B is different than on Machine A

  • remotebox can be a resolvable name or an IP address

Alternatives:

  • Places -> Connect to Server, and then select Service Type of SSH from the pulldown menu of the Connect to Server dialog box
link|improve this answer
feedback

Why not use scp File.zip username@AnotherComputer:~/ ?

link|improve this answer
feedback

you need to use scp to either pull or push the file. From one machine to the other, you'd do something like

scp File.zip username@ipaddress:/home/me/Desktop/file.zip

link|improve this answer
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.