Are you encountering the dreaded "Unprotected Private Key File" error when trying to establish an SSH connection on Windows 11? Don't worry; you're not alone. This error occurs when your private key file has overly permissive settings, compromising its security. Let's walk through the steps to resolve this issue and get you connected securely.
Step-by-Step Guide to Fix the SSH Private Key Permissions Error:
- Locate Your Private Key File: Open File Explorer and navigate to your private key file (e.g., "my_private_key.pem").
- Access File Properties: Right-click on the file and select "Properties".
- Open Security Settings: In the Properties window, click on the "Security" tab, then click "Advanced".
- Disable Inheritance: Click "Disable inheritance", then choose "Convert inherited permissions into explicit permissions on this object".
- Remove Unnecessary Permissions: Select each user or group that isn't your account and click "Remove".
- Add Your User Account: Click "Add", then "Select a principal". Type your Windows username and click "Check Names". Click "OK".
- Set Correct Permissions: With your user selected, click "Full control" under Basic permissions. Click "OK".
- Apply and Confirm: Click "Apply" and "OK" to close all windows.
- Attempt SSH Connection:
Open Command Prompt and try connecting again:
ssh -i "C:\path\to\my_private_key.pem" username@server.example.com
Thanks for sharing your feedback! It helps us grow.