Here’s the prompt from ChatGPT, it summarises my issue quite well. I realised the issue before waiting for the answer, but still anyway. I guess I’ve transferred .ssh directory from my Arch Linux system by just copying files.


If your Fedora server is prompting you for a password instead of using your SSH key, there may be a few potential issues to check:

  1. Permissions on the .ssh Directory and authorized_keys File:

    • Make sure the permissions are correct. Your .ssh directory and the authorized_keys file must have the appropriate permissions to work properly:
      chmod 700 ~/.ssh
      chmod 600 ~/.ssh/authorized_keys
      
    • Also, make sure your home directory (~) is not writable by others:
      chmod 755 ~
      
  2. Ownership of Files and Directories:

    • Verify that the ownership of the .ssh directory and authorized_keys file is correct. They should be owned by your user:
      chown -R yourusername:yourusername ~/.ssh
      
  3. SSH Daemon Configuration (sshd_config):

    • Check your /etc/ssh/sshd_config file to ensure the following lines are set correctly:
      PubkeyAuthentication yes
      AuthorizedKeysFile .ssh/authorized_keys
      
    • If you made any changes, restart the SSH service:
      sudo systemctl restart sshd
      
  4. SELinux Configuration (if enabled):

    • If SELinux is enabled, ensure that the .ssh directory and files have the correct context:
      restorecon -R -v ~/.ssh
      
  5. SSH Client Configuration:

    • Ensure your SSH client is using the correct key. You can specify the key explicitly:
      ssh -i ~/.ssh/your_private_key user@yourserver
      
  6. Key Format and Content:

    • Make sure your public key in authorized_keys is in the correct format (a single line without any extra spaces or line breaks).

Check these steps and let me know if any issues persist.