Set ~/.ssh/id_ed25519 so only its owner can read and write it.
Grant no permissions to group or others.
Which command is appropriate?
chmod 600 grants the owner read/write and no permissions to group or others, which protects the private key file.
Detailed explanation
chmod 644 ~/.ssh/id_ed25519Incorrect. 644 grants read access to group and others.
Incorrect. 644 grants read access to group and others.
chmod 755 ~/.ssh/id_ed25519Incorrect. 755 grants broad read and execute permissions.
Incorrect. 755 grants broad read and execute permissions.
chmod 400 ~/.ssh/id_ed25519.pubIncorrect. It changes the public key file rather than the private key.
Incorrect. It changes the public key file rather than the private key.
chmod 600 ~/.ssh/id_ed25519Correct. It grants only owner read/write access.
Correct. It grants only owner read/write access.
Try it yourself
An example you can run in a temporary verification environment.
printf '%s
' '600 -> owner rw-, group ---, other ---'Expected result
600 -> owner rw-, group ---, other ---Key points
- Private keys are secret
- 600 means owner rw
- Public keys can be shared
Notes
- Environment: POSIX permission対応表
- Command output formatting can vary slightly by distribution or tool version.
- Run the example in a temporary directory or process when possible.
Foundation review
Read the scope first
Check whether the command acts on the current shell, a new process, an existing process, or a file.
Verify the observable result
Use the supplied command and compare the output with the expected result.