change location of user maildir

hey how do I change the default location of the user (or default new users) maildir?

currently at

  • /home/$domain/homes/$user/Maildir

I want to change it to

  • /Thisdir/$domain/homes/$user/Maildir

Please note I do not want to simply change /home/ to /thisdir/ - as it would upset the webhosting side of things. I just want to put email in a separate place, is this poss?

Hrm… I unfortunately don’t think there’s a way to do that.

The way Virtualmin is designed, it assumes all users go into /home/$domain, and that email users go into a subdirectory underneath that dir.

The best I can think of is that you may be able to write up a bit of a hack to get around that, but it wouldn’t be pretty :slight_smile:

I believe that in System Settings -> Module Config -> Actions upon Server and User creation, that “Command to run before making changes to a server” is triggered whenever creating a user. You could always write up a script to manually make the changes you’re after – as what you’d essentially need to do is change the email user’s home directory.

That’ll require some custom shell scripting and perhaps a little bit of luck :slight_smile:


Hi Eric, thanks for replying

I think this works if I do it manually, so yeah I think a script somewhere in “Actions upon Server and User creation” to run just after user creation may do the trick.

Manual Steps

  • Create /$nfs-share/$domain/homes/$user
  • Change user home directory to above in LDAP database
  • chown -R user.domain:domain /$nfs-share/$domain/homes/$user

I sent an email to the user and it ended up at the right place, cool!

Problem is tho, I would have no idea how to write a script to do the above!

This is exactly what I am looking to do too. Given this is from 2010 is there a newer way to do this with the latest Virtualmin?

To help anybody else having an issue with trying to host the mail on an S3 bucket rather than their EC2 instance there are issues with timestamps between the 2 filesystems which causes “Warning: Created dotlock file’s timestamp is different than current time” errors. So close, but no cigar.