linux – key works for logging in via ssh, but scp gives permission denied

I am relatively new to the Linux environment, and I have been trying to setup a server to for hosting purposes.

I have been using an ssh key to log into my server with no issues, but when I try to use scp I am given a “Permission Denied” message. I have password auth turned off normally, but when I did turn it back on I was able to log in and upload the file via scp just fine. I also found it odd that when I went to scp to the server initially, I was given the usual message that the server fingerprint has not been identified and would I like to add it to the list of known hosts? The reason I found this odd is because I already added my server to the list of known hosts when I first setup the server, so why did it ask me again? Shouldn’t the host already be known when I did it via ssh initially? I was really confused and made sure that I was using the correct server path a bunch of different times and each time I got that message to add to the known list, when I already had that server added (logged into ssh as well just fine). When it added it to the list of known hosts I could log in but not with the ssh key.

I added my ssh key initially using ssh-copy-id, but I also tried using scp to upload the ssh keys to the server, with no luck.

scp ~/.ssh/id_rsa.pub <username>@<host>:~/.ssh/authorized_keys

I even attempted to redo `ssh-copy-id’ as well as do it with -f and nothing.

The only thing I can think of is maybe there is some sort of permissions issue, but I don’t see why the permissions would be different when using the user via ssh compared to via scp. The only other thing I can think of is somehow there is something weird going on with looking at the host and that’s affecting the ssh key lookup? I’m not sure.

I’m curious if anyone has any clue what is going on? Thank you