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:
Permissions on the
.ssh
Directory andauthorized_keys
File:- Make sure the permissions are correct. Your
.ssh
directory and theauthorized_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 ~
- Make sure the permissions are correct. Your
Ownership of Files and Directories:
- Verify that the ownership of the
.ssh
directory andauthorized_keys
file is correct. They should be owned by your user:chown -R yourusername:yourusername ~/.ssh
- Verify that the ownership of the
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
- Check your
SELinux Configuration (if enabled):
- If SELinux is enabled, ensure that the
.ssh
directory and files have the correct context:restorecon -R -v ~/.ssh
- If SELinux is enabled, ensure that the
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
- Ensure your SSH client is using the correct key. You can specify the key explicitly:
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).
- Make sure your public key in
Check these steps and let me know if any issues persist.