Mac – Transferring files using ssh on terminal

macscpterminal

I am trying to transfer a file to Computer A (my computer) from Computer B (the remote computer). I have looked through different threads, but nothing is working. First, I log onto Computer B using ssh which works fine. My code for the file transfer is

scp userB@hostB:~/Desktop/(file_name) ~/Desktop/

when I plug this in, it asks for Computer Bs password, which I enter. Then I get the error

scp: /Users/userB/Desktop/(file_name) : No such file or directory

I know that the file is there, however. What am I doing wrong?

Best Answer

Have you tried, while logged on to Computer A :

scp (Computer B user)@(Computer B address):/Users/(Computer B user)/Desktop/(file_name) ~/Desktop/

It's more explicit than using ~, which may not behave as you might want it to on the remote machine - although it will be fine for local file specifications.