Why getting a permission denied (public key) error for SCP when SSH works

Perhaps you've found a bug?

Another way of doing the same thing (wonder if this works for you?):

scp -oIdentityFile=/Users/emmie/Desktop/Blocks/blocks_key.pem ~/Desktop/Blocks/code/www/uploadtest.html [email protected]:/var/www

Also, it might help (just curious) if you post the output of:

stat /Users/emmie/Desktop/Blocks/blocks_key.pem


From your verbose output see this message.

Warning: Identity file /Desktop/Blocks/blocks_key.pem not accessible: No such file or directory.

Instead of using ~/, try providing the full path in your command line. Perhaps you are using a shell that doesn't support the expansion of ~ to your home directory.

Not sure if that is your problem, but you will give a path to scp that will actually allow it to find the key on the filesystem, in order to use it.