Greg's Blog

helping me remember what I figure out

Using Aliases

| Comments

Using aliases

This document will introduce you to the aliases file. You can use this file to create mailing lists, reference old user accounts to new ones, or even point departed employee accounts to a manager’s account to make sure that no e-mail message gets lost. Before we begin please make sure that you have either superuser access rights or are logged in as root. Also you will have to be familiar with Vi editing (see Basic Vi editing for an introduction). Also in the examples don’t type the information in brackets, unless othewise specified, as it’s only their for comment purposes.

Creating alternative user names
To set up an alias you need to edit the file aliases located in /etc. To alias alternative user names to an actual account follow this example using our John Smith:

vi /etc/aliases
(Scroll down the alias file until you get to #USER LIST, immedialtely after it add an entry for John Smith using the following syntax)
#jsmith John Smith Sales
(Next you can create your own alias lists of alternative names, insert the following lines)
#Groups at your company
#Alternative user names
johns: jsmith
(Save and exit the file and type the following command to inform sendmail of the update)
sendmail -bi

Creating a mailing list The same technique is applied to creating a mailing list. Here you simply create an alias and add all the account names that the messages sent to alias are to be delivered to. To clarify this point just imagine you want to create a sales team mailing list with the following address sales@yourdomain.com. Here the alias will be sales and all members of the sales team have tobe added to that alias.

vi /etc/aliases
(Scroll to the of the alias file, i.e. after the last entry made and insert the following assuming that you two user called jsmith and jdough)
#Sales at your company
sales: jsmith,jdough
(Save and exit the file and type the following command to inform sendmail of the update)
sendmail -bi

There is one thing you should bear in mind when editing the aliases file. Make sure that you never leave more than 1 blank line at the end of the file. If you leave 2 empty lines when it comes to running the sendmail -bi command, you’ll get an error message and the system won’t be updated. Please note it’s also good practice to add a reference to the user list (#USER LIST) every single time you add a new user to the system. Chances are he’ll have to be added to a mailing group anyway. Right’s that’s all…