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.

  • now I have Permission denied your non-root user usually does not have access to files under /var/. This is correct.
    – Jakuje
    Feb 21, 2016 at 15:31

1 Answer 1


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).

  • Thank, I didn't disconnect from the SSH first, now I have Permission denied, I have to review the server settings. thank you.
    – Kevin
    Feb 21, 2016 at 15:28
  • I've never run into that. Must be a custom setting in sshd....
    – Allan
    Feb 21, 2016 at 16:04

You must log in to answer this question.

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