3

How do I make the adduser script create the appropriate Maildir directory of the new user?


I have an Ubuntu server running postfix. When I first installed it was deliverying emails to /var/mail/<user>/.

I've changed to use /home/<user>/Maildir by putting home_mailbox = Maildir/ on /etc/postfix/main.cf.

At first I didn't worked because there wasn't a Maildir directory for my user (email was delivered back on my provider with the error).

Then I created the Maildir directory, with the subdirectories new, cur and tmp as Maildir uses. Worked fine after that.

But this way I would have to manually create those directories everytime I add an user. Is there anyway to make the adduser script (that is what I use) to create those for me?

talles
  • 1,955
  • 2
  • 14
  • 14
  • possible duplicate of [When I create a new user, how do I automatically create a .virtualenvs directory in their home directory?](http://askubuntu.com/questions/29111/when-i-create-a-new-user-how-do-i-automatically-create-a-virtualenvs-directory) – muru Aug 03 '14 at 22:45

1 Answers1

4

According to this manpage on adduser, it will copy anything present in /etc/skel (or another skeleton directory, if specified) to the newly created home directory. The Ubuntu manpage only mentions files, but I think the functionality might hold for directories as well. So I suggest that you create a Maildir directory in /etc/skel, along with cur, new and tmp subdirectories. According to the answer to When I create a new user, how do I automatically create a .virtualenvs directory in their home directory?, it works for directories as well.

Robert Siemer
  • 2,429
  • 2
  • 25
  • 31
muru
  • 193,181
  • 53
  • 473
  • 722
  • Great, looks like just what I needed. I'm going to test it later; after that I come here and comment if it worked. – talles Aug 03 '14 at 23:05