Syns First Liner User Thread owner 16 Oct 2025 #1 After copying my SSH keys to a new user, I get “Permission denied (publickey)”. What am I missing?
Solution CL4Y 16 Oct 2025 Fix ownership/permissions and contexts so sshd trusts your keys. Bash: # as the target user mkdir -p ~/.ssh && chmod 700 ~/.ssh mv id_rsa id_rsa.pub authorized_keys ~/.ssh/ chmod 600 ~/.ssh/id_rsa ~/.ssh/authorized_keys chown -R $USER:$USER ~/.ssh if SELinux is enforcing (RHEL/CentOS/Fedora): restorecon -Rv ~/.ssh Check Bash: ssh -v user@server If still failing, ensure [/etc/ssh/sshd_config] has PubkeyAuthentication yes, then: Bash: sudo systemctl reload sshd
Fix ownership/permissions and contexts so sshd trusts your keys. Bash: # as the target user mkdir -p ~/.ssh && chmod 700 ~/.ssh mv id_rsa id_rsa.pub authorized_keys ~/.ssh/ chmod 600 ~/.ssh/id_rsa ~/.ssh/authorized_keys chown -R $USER:$USER ~/.ssh if SELinux is enforcing (RHEL/CentOS/Fedora): restorecon -Rv ~/.ssh Check Bash: ssh -v user@server If still failing, ensure [/etc/ssh/sshd_config] has PubkeyAuthentication yes, then: Bash: sudo systemctl reload sshd
CL4Y Keyboard Ninja Administrator 16 Oct 2025 #2 Fix ownership/permissions and contexts so sshd trusts your keys. Bash: # as the target user mkdir -p ~/.ssh && chmod 700 ~/.ssh mv id_rsa id_rsa.pub authorized_keys ~/.ssh/ chmod 600 ~/.ssh/id_rsa ~/.ssh/authorized_keys chown -R $USER:$USER ~/.ssh if SELinux is enforcing (RHEL/CentOS/Fedora): restorecon -Rv ~/.ssh Check Bash: ssh -v user@server If still failing, ensure [/etc/ssh/sshd_config] has PubkeyAuthentication yes, then: Bash: sudo systemctl reload sshd Upvote 0 Downvote Solution
Fix ownership/permissions and contexts so sshd trusts your keys. Bash: # as the target user mkdir -p ~/.ssh && chmod 700 ~/.ssh mv id_rsa id_rsa.pub authorized_keys ~/.ssh/ chmod 600 ~/.ssh/id_rsa ~/.ssh/authorized_keys chown -R $USER:$USER ~/.ssh if SELinux is enforcing (RHEL/CentOS/Fedora): restorecon -Rv ~/.ssh Check Bash: ssh -v user@server If still failing, ensure [/etc/ssh/sshd_config] has PubkeyAuthentication yes, then: Bash: sudo systemctl reload sshd