I use Ubuntu 14.04.3 LTS . How to change the location of the Mailbox /home/user/Maildir/ to /Location/Mail/?
I don't have to create home directory for that user.
I did some changes in the /etc/default/useradd file and /etc/login.defs but when I create a new user doesn't reflect(mail directory is created in /home/user/ directory).

So I need to create a user of which its mail directory points to /Location/Mail/ by default.

I also use postfix. If I can change default user mail directory in postfix, it is also okay for me.


To change the location of Mailbox, include the below line in the file '/etc/postfix/main.cf'

virtual_mailbox_base = /Location/Mail/

If you don't want to create home directory(i.e non Unix Account user) then include the below line in the file '/etc/postfix/main.cf'

virtual_alias_maps = hash:/etc/postfix/userlist

Once you added these files in Postfix, add the required user's you wish to configure the mailbox, In File /etc/postfix/userlist,

user1@example.com   user1
user2@example.com   user2

...with your required no.of users...

If you do need to create user's default maildir to /Location/Mail/ instead of /home then modify in the file '/etc/default/useradd'


This will create Mailbox in the path /Location/Mail//Maildir/


The easiest way is to set the mail_spool_directory to the new directory:

sudo postconf mail_spool_directory=/Location/Mail/

For this to work, home_mailbox must be empty:

sudo postconf home_mailbox=

However, your server might be set up to use a different command to write deliver mails to a user. The mailbox_command parameter might have been set (e.g. mailbox_command = procmail -a "$EXTENSION" in /etc/postfix/main.cf) or a transport using the Dovecot MDA could be defined in /etc/postfix/master.cf.

In other words: The above should work, but this really depends on the rest of your setup.

  • How do I change the mailbox directory from User home dir to another default dir? – Ruban Savvy Jan 27 '16 at 10:56
  • The two commands above should be sufficient to change the default directory using postfix. As already stated, it's hard to tell without knowing your exact setup. Add the content of /etc/postfix/main.cf and /etc/postfix/master.cf to your question if you need more details. – tarleb Jan 27 '16 at 16:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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