0

I am trying to copy a file from my local Mac to my Linux instance running on the Amazon EC2 / AWS Cloud.

I am able to connect to the server via Terminal, but am unable to get my file up to the server.

Here is what I've tried: (yes, I replaced [email protected] with the actual server info)

scp /Users/me/Desktop/file.txt [email protected]:file.txt

result: Sink: scp: /Users/me/Desktop/file.txt: No such file or directory

scp ~/Users/me/Desktop/file.txt [email protected]:file.txt

result: scp: /home/myuser/Users/me/Desktop/file.txt: No such file or directory

So it seems that when I use the ~/Users/ ... it thinks I am trying to copy the file from the server? But when I only use /Users/ ... , it still says it cannot find the file.

Any help would be greatly appreciated.

More Info ...

Here are some additional tries I have made, all with the same result:

scp localhost:/Users/me/Desktop/file.txt [email protected]:/home/myuser/file.txt

scp /Users/me/Desktop/file.txt [email protected]:/home/myuser/file.txt

Is there something else I need to do to tell it to grab the file from my desktop machine?

Figured it out ...

Okay, so I was trying to do this while I was already connected to the server. It makes sense to me now, but I was connecting to the server and then trying to move the file.

Thank you for all your help and sorry for the confusion !

3 Answers 3

2

Generally you have to specify the path on the remote machine.

So...

scp /path/to/textfile.txt [email protected]:/path/to/where/you/want/it/
5
  • I have also tried that, makes no difference - and doesn't really answer the question of why it is saying it can't find the file on the local computer.
    – Chris
    Dec 9, 2011 at 3:40
  • provide output of 'stat /path/to/file.txt'
    – thinice
    Dec 9, 2011 at 3:59
  • If you're using the wrong syntax, you can get that error message - it's why I suggested it. Dec 9, 2011 at 4:17
  • It says that it cannot stat the file... is there something I need to do to tell it to look on my local machine?
    – Chris
    Dec 9, 2011 at 17:16
  • Please see edits to the original post.
    – Chris
    Dec 9, 2011 at 17:21
0

looks like your default directory on remote server is /Users/me/Desktop, you should create the directory on remote server,like this:

mkdir /Users/me/Desktop

or put the file.txt to a exiting path.

ssh /path/to/file.txt [email protected]:/path/to/target/file.ext
2
  • No... /Users/me/Desktop is on my local machine.
    – Chris
    Dec 9, 2011 at 17:14
  • Please see edits to the original post.
    – Chris
    Dec 9, 2011 at 17:21
0

I think you gave defective path to command...

Most absolute path begins with slash "/" which means root directory. It's also applies to remote system. Check this out:

scp /path/to/read/file.txt [email protected]:/file.txt

or

scp /path/to/read/file.txt [email protected]:/path/to/write/file.txt

And also in your condition, you must check path if you get errors. You can check the path by type command below in your folder that where the file.txt is.

pwd

... Anyway, if you think your file is on the right place, you can change directory to where it is and check the pwd result

if you can change your path by command below:

cd /Users/me/Desktop/

and you can list the file you want to send:

ls -la | grep file.txt
-rw-r--r--  1 me me 14320 2011-11-15 09:50 file.txt

there might be user permission issues. Check if you can display inside the file by cat file.txt If you do not have read permission on the file you can't send file to anywhere. First of all you must granted some permissions on that file.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .