ssh authentication setup upon virtualhost creation

Hello,

Is there a way to have a set of ssh keys automatically be added to a new site’s .ssh/authorized_keys file upon site creation?

–jason

If it’s the same keys for every domain, put it in /etc/skel/.ssh/authorized_keys. That gets copied into every new domain user home (by default; the skel directory is configurable in Server Templates). That’s pretty much the same answer to any “how do I put some specific files into the domain home directory on during creation”.

If it needs to be custom keys for each domain, I’m not sure of the easiest way to go about that. You could use “Commands to run after making changes to a server” (in Virtualmin Configuration->Actions upon server and user creation), which could be used to copy keys from a specified location, maybe with substitution of the domain name (using the $DOM variable).

Hello, the Skel directory ought to do it! Thanks!

The second part of your answer is intriguing on many levels, so thanks for that also!

–jason