Skip to main content

Virtual user et alis dans postfix

Postfix is a great mailer, but if you're new to administering Postfix, finding your way around can be difficult. For example, just finding information on adding users to a Postfix system can be quite a trial.

Postfix is a great mailer, but if you're new to administering it, finding your way around can be difficult. Here's how to get started.

In part, this is because Postfix can be set up in a number of ways. Some installations use Postfix alone, others use Postfix in conjunction with other apps and store user information in MySQL. You can have users who have actual accounts on a system, or you can have users on virtual domains that don't have a login but still receive mail. Or you might want aliases that include several users, so everybody on the "marketing" list gets mail or all folks in sales, legal or development can receive messages.

For this tip, I'll assume that you've inherited a Postfix domain and want a way to add users or aliases quickly.
Adding Users


The simple way to add a user is to simply add a new account on the system. Postfix will handle the rest. For example, on my server running Ubuntu, I'd just use adduser username, and Postfix would just do the right thing with regard to sending mail to that user, delivered locally.

But what if you don't want to create a system account for the user? You should have a virtual domain set up that is not configured as a mydestination domain. For more on this, be sure to read the Postfix guide on virtual domain hosting.

Users are then added in the form user@domain and then either the mailbox on the system or handed off to Courier or another mail delivery program in the /etc/postfix/vmailbox file.

However, if you don't have a /etc/postfix/vmailbox file, odds are your system was configured to deliver to local accounts. You should check /etc/postfix/main.cf and look for the linemydestination. If it includes the domain you're adding users for, then they're being added as regular users.

Otherwise, in /etc/postfix/vmailbox, add a line like:


utisateurV@mondomain.net mondomain.net/utilisateurV


You should see some examples already. This will deliver mail to a mailbox called utisateurV in /var/mail/vhosts/mondomain.net -- assuming your system is set up to deliver mail there. Note, you can store mail in an mdir format instead by adding a slash after the username.

Next, run postmap against the file (/etc/postfix/vmailbox) and postfix reload.

To add an alias, go to /etc/aliases and add the alias like so:

alias: localuser # For a local user mapping
alias2: user@remote.com # For a remote user mapping

Comments

Popular posts from this blog

Setting Up Network RAID1 With DRBD On Ubuntu 12.04

A Network software raid1Setting Up Network RAID1 With DRBD On Ubuntu 12.04 This tutorial shows how to set up network RAID1 with the help of DRBD on two Ubuntu 12.04 systems. DRBD stands for Distributed Replicated Block Device and allows you to mirror block devices over a network (like raid1 with 2 disks). This is useful for high-availability setups because if one node fails, all data is still available from the other node.
1 Preliminary Note We use two servers (both running the same version of linux in our case Ubuntu 12.04): server1.cofares.net (IP address 192.168.10.100)server2.cofares.net (IP address: 192.168.10.101) Both nodes have an unpartitioned second drive (/dev/sdb) with identical size (X GB) that I want to mirror over the network (network RAID1) with the help of DRBD. It is important that both nodes can resolve each other, either through DNS or through /etc/hosts, /etc/hosts would be a better choice (our 2 servers are on the same switch and local. You can modify /etc/hosts on…

HOWTO remove all dangling commits from your git repository

A good explanation of the dangling (fr: ballants) commits source tells you how they get created.

git fsck --fullChecking object directories: 100% (300/300), done. Checking objects: 100% (10658/10658), done. dangling commit x.... dangling blob y.... dangling commit z.... dangling blob w.... dangling blob a.... dangling commit b....
How to quickly remove those?
git reflog expire --expire=now --all git gc --prune=now