0

I want to acces a remote server via ssh which has set the location for authorized keys set as /path/to/ssh/authorized_keys.%u.

Now I am wondering how I can motivate ssh-copy-id to create an authorized_keys file at that location following that naming convention.

I tried ssh-copy-id -i /path/to/id_rsa.pub username@[ip-addresse] -o /path/to/ssh/authorized_key.username but that gives me an error:

ERROR: command-line: line 0: Bad configuration option: /path/to/ssh/authorized_keys.username

writing this I wonder whether scp alernatively might provide a solution (couln't say how exactly though).

Can anybody help with this?

vrms
  • 287
  • 1
  • 7
  • 17

1 Answers1

0

ssh-copy-id cannot install public keys to a user provided file. .ssh/authorized_keys (or /etc/dropbear/authorized_keys for a dropbear server). You could contribute an option to allow the user to provide this, but will be some time before such a patch is accepted upstream and downstream.

When the user has a complete authorized_keys locally, they can upload that with sftp. Less useful if they do not know all the keys needed, and might lock someone out if some are omitted.

Alternatively, configure sshd so users don't need to upload their keys to each host. Consider AuthorizedKeysCommand that looks up keys from some system, whether a fancy FreeIPA or something simpler like downloading from some web server.

John Mahowald
  • 32,050
  • 2
  • 19
  • 34
  • thks for clarifying. Indeed that would be a nice contribution. I am not capable to provide such a PR though, I am afraid. – vrms Sep 16 '21 at 06:47