Are there any reasons to get a pubkey denied after you run ssh-copy-id onto your server? I’ve already restarted the sshd service but I still get pubkey denied after I copied my ssh I.D. to my server. I am thinking about just removing all the keys I have on the server and re-adding them but I was hoping someone else may have an idea before I do that. Thanks!

EDIT: OKAY. I fixed it. I appreciate all the help I received. I still really could not figure out what the actual issue is. But I did have some extra ssh keys that I wasn’t using from old machines and after I deleted those and readded my key everything seems to work

  • Matt@netmonkey.tech
    link
    fedilink
    English
    arrow-up
    5
    ·
    1 year ago

    Have you confirmed that the public keys exist on the remote server in your .ssh directory? Are the permissions correct?

    • BRINGit34@lemmygrad.mlOP
      link
      fedilink
      English
      arrow-up
      1
      ·
      1 year ago

      I’ll have to check when I get off work. I never have any errors when copying my id so I am not sure why they wouldn’t be there but I will check

      • Matt@netmonkey.tech
        link
        fedilink
        English
        arrow-up
        2
        ·
        1 year ago

        Same. I’ve never had it screw up before, but the only thing I can imagine is that something’s not right with the keys.

        As an aside, I did recently create a new server, and somehow managed to completely ignore the errors in ssh-copy-id. Turns out I forgot to use -m (to create my home directory) in useradd when I went to create my personal account. Oops!

  • uin@lemmy.world
    link
    fedilink
    English
    arrow-up
    4
    ·
    1 year ago

    Also: Make sure that the user you ran “ssh-copy-id” against on the remote machine is also the user you’re trying to log in with.

  • r0ckr@lemmy.world
    link
    fedilink
    English
    arrow-up
    1
    ·
    1 year ago

    Try running this command on your target system:

    cat $HOME/.ssh/authorized_keys

    Does the private key part of your key pair show up in the list?

  • mirisbowring@lemmy.primboard.de
    link
    fedilink
    English
    arrow-up
    1
    ·
    1 year ago

    did you verify to use the correct corresponding private key?

    You can specify the keyfile with the -i option if i remember correctly

  • TCB13@lemmy.world
    link
    fedilink
    English
    arrow-up
    1
    ·
    1 year ago

    How many private keys do you have in your client machine? Sometimes people generate a new key par but there’s a previous one on the system that gets served before the right one. Go into your .ssh directory in the client and check if there’s anything else there.