diff --git a/keygen.py b/keygen.py index e84e7e4..a6921c6 100644 --- a/keygen.py +++ b/keygen.py @@ -53,6 +53,7 @@ def save_keypair( pub_path = path.with_suffix("").parent / (path.name + ".pub") + path.parent.mkdir(mode=0o700, parents=True, exist_ok=True) path.write_bytes(private_bytes) path.chmod(0o600) pub_path.write_bytes(public_bytes + b"\n") @@ -145,9 +146,9 @@ def build_parser() -> argparse.ArgumentParser: shared = argparse.ArgumentParser(add_help=False) shared.add_argument( "-o", "--output", - default="id_ed25519", + default=str(Path.home() / ".ssh" / "id_ed25519"), metavar="PATH", - help="output path for the private key (default: id_ed25519)", + help="output path for the private key (default: ~/.ssh/id_ed25519)", ) shared.add_argument( "-C", "--comment",