Skip to content

authorized_keys not synced after change it on the host #9

@acblbtpccc

Description

@acblbtpccc

Hi! I really appreciate this repo as it simplifies the process of bastion sshd setup and user management.

I noticed that when the container starts, it copies the authorized_keys file to "%h/.ssh/authorized_keys". However, after adding new public keys to the authorized_keys file on the host, the changes are not automatically synchronized (which is understandable given the current copy-on-start behavior), so I need to rebuild the container to make the changes take effect.

After considering the SSH_USER and permissions, I tried an alternative approach by:

  1. Using "AuthorizedKeysFile /authorized_keys %h/.ssh/authorized_keys" in sshd config
  2. Mounting this configuration file through sshd_config.d/extra.conf

This solution allows:

  • Direct modification of the host's authorized_keys file and changes could take effect without container restart, so no SSH connection interruption

I'd like to know if:

  1. Is there any potential issue with this approach, like I missed something so that my authorized_keys file is not synced by default?
  2. Is the current non-sync behavior intentional like a feature?

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions