Make ~/.ssh/id_ed25519 readable and writable only by its owner.
Which command is appropriate?
chmod 600 grants owner read/write and no group or other permissions to a private key.
Detailed explanation
chmod 644 ~/.ssh/id_ed25519Incorrect. 644 lets group and other users read the private key.
Incorrect. 644 lets group and other users read the private key.
chmod 755 ~/.ssh/id_ed25519Incorrect. 755 grants broad read and execute permissions.
Incorrect. 755 grants broad read and execute permissions.
chmod 600 ~/.ssh/id_ed25519Correct. 600 permits only owner read/write.
Correct. 600 permits only owner read/write.
chmod 400 ~/.ssh/id_ed25519.pubIncorrect. It targets the public key and changes neither the private key nor its required mode.
Incorrect. It targets the public key and changes neither the private key nor its required mode.
Try it yourself
An example you can run in a temporary verification environment.
tmp=$(mktemp -d); printf 'private' > "$tmp/id_ed25519"; chmod 600 "$tmp/id_ed25519"; stat -c '%a' "$tmp/id_ed25519"; rm -rf "$tmp"Expected result
600Key points
- Private key
- chmod 600
- Different from public key
Notes
- Environment: GNU coreutils / 一時ディレクトリ
- 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.