SSH (or SFTP) upload files from OSX terminal I'm trying to upload a file through terminal (didnt managed to do it trough transmit.app)


I'm connected to SSH to my server.
I want to sent a file from my Local desktop to my server.


That the command I'm trying : 

scp /Users/username/Desktop/ad-blocker.sh user@IP:/var/packages/DNSServer/target/script/


I always have this error though " No such file or directory "

not a expert of SSH, but if I'm connected to my server to SSH, how would terminal access my local file anyway (/Users/username/Desktop/ad-blocker.sh)

Kind regards.
You have to make sure that the path you are copying to exists.

Before executing your scp command, ssh into your remote host, cd to the directory, and issue the pwd command.  That will give you the current working directory.

Copy that to your clipboard.

Exit SSH, then re-issue the scp command with the directory (paste from your clipboard).