Linux – Trying to SCP from Local Mac to Amazon AWS Linux Machine

amazon-web-serviceslinuxmacscp

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 myuser@XXX.XXX.XXX.XXX with the actual server info)

scp /Users/me/Desktop/file.txt myuser@XXX.XXX.XXX.XXX:file.txt

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

scp ~/Users/me/Desktop/file.txt myuser@XXX.XXX.XXX.XXX: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 myuser@xxx.xxx.xxx.xxx:/home/myuser/file.txt

scp /Users/me/Desktop/file.txt myuser@xxx.xxx.xxx.xxx:/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 !

Best Answer

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

So...

scp /path/to/textfile.txt myuser@XXX.XXX.XXX.XXX:/path/to/where/you/want/it/