Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

In linux, If I added a file or a directory in /etc/skel, when I create a user this get the file or dir in skel.


ssh-keygen -t rsa 

I can create the ssh keys

how I can automatically create the ssh keys each time when I added a user?

share|improve this question
mmm a problem is : how the user set the passphrase? – JuanPablo Apr 19 '12 at 23:03

man adduser under debian:

If the file /usr/local/sbin/adduser.local exists, it will be executed after the user account has been set up in order to do any local setup.

share|improve this answer

You should write a wrapper script around useradd that runs ssh-keygen and anything else you need when you create an account.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.