Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Programming
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Databases
Mail Systems
openSolaris
Eclipse Documentation
Techotopia.com
Virtuatopia.com
Answertopia.com

How To Guides
Virtualization
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Windows
Problem Solutions
Privacy Policy

  




 

 

System Administration Guide: Network Services
Previous Next

Administering Mail Alias Files

Mail aliases must be unique within the domain. This section provides the procedures for administering mail alias files. Alternately, you can use the Mailing List feature in the Solaris Management Console to perform these tasks on the aliases database.

In addition, you can create database files for the local mail host by using makemap. Refer to the makemap(1M) man page. The use of these database files does not provide all of the advantages of using a name service such as NIS or NIS+. However, you should be able to retrieve the data from these local database files faster because no network lookups are involved. For more information, refer to Interactions of sendmail With Name Services and Mail Alias Files in Chapter 14, Mail Services (Reference).

Choose from the following procedures:

How to Initiate an NIS+ mail_aliases Table

You can use the aliasadm command to manage entries in an NIS+ table. To create a table, follow these instructions. For more information, refer to the aliasadm(1M) man page.

  1. Either be a member of the NIS+ group that owns the table, or become root on the mail server, or assume an equivalent role.

    Roles contain authorizations and privileged commands. For more information about roles, see Configuring RBAC (Task Map) in System Administration Guide: Security Services. To configure a role with the Primary Administrator profile, see Chapter 2, Working With the Solaris Management Console (Tasks), in System Administration Guide: Basic Administration.

  2. Initiate an NIS+ table.
    # aliasadm -I
  3. Add entries to the table.

How to List the Contents of the NIS+ mail_aliases Table

To see a complete list of the contents of the table, follow these instructions.

  1. Either be a member of the NIS+ group that owns the table, or become root on the mail server, or assume an equivalent role.

    Roles contain authorizations and privileged commands. For more information about roles, see Configuring RBAC (Task Map) in System Administration Guide: Security Services. To configure a role with the Primary Administrator profile, see Chapter 2, Working With the Solaris Management Console (Tasks), in System Administration Guide: Basic Administration.

  2. List all of the entries in alphabetical order by alias.
    # aliasadm -1

    For more information, refer to the aliasadm(1M) man page.

Example 13-2 Listing an Individual Entry From the NIS+ mail_aliases Table

Alternately, you can use the aliasadm command to list individual entries. After you complete the first step in this procedure, type the following:

# aliasadm -m ignatz
ignatz: ignatz@saturn # Alias for Iggy Ignatz

The command matches only the complete alias name, not partial strings. You cannot use metacharacters, such as * and ?, with aliasadm -m.

Example 13-3 Listing Partial Matches From the NIS+ mail_aliases Table

Also, you can use the aliasadm command to list partial matches. After you complete the first step in this procedure, type the following:

# aliasadm -l | grep partial-string

Replace partial-string with the desired string for your search.

How to Add Aliases to the NIS+ mail_aliases Table From the Command Line

To add two or three aliases to the table, follow the following instructions. If you are adding more than two or three aliases, see How to Add Entries by Editing an NIS+ mail_aliases Table.

  1. Compile a list of each of your mail clients, the locations of their mailboxes, and the names of the mail server systems.
  2. Either be a member of the NIS+ group that owns the table, or become root on the mail server, or assume an equivalent role.

    Roles contain authorizations and privileged commands. For more information about roles, see Configuring RBAC (Task Map) in System Administration Guide: Security Services. To configure a role with the Primary Administrator profile, see Chapter 2, Working With the Solaris Management Console (Tasks), in System Administration Guide: Basic Administration.

  3. (Optional) If necessary, initiate an NIS+ table.

    If you are creating a completely new NIS+ mail_aliases table, you must first initiate the table. To complete this task, refer to How to Initiate an NIS+ mail_aliases Table.

  4. Add aliases to the table.

    See this example of a typical entry.

    # aliasadm -a iggy iggy.ignatz@saturn "Iggy Ignatz"

    The following list describes the input from the preceding example.

    -a

    The option for adding an alias

    iggy

    The short form of the alias name

    iggy.ignatz@saturn

    The expanded alias name

    "Iggy Ignatz"

    The name for the alias in quotation marks

  5. Display the entry that you created and ensure that the entry is correct.
    # aliasadm -m alias
    alias

    The entry that you created

    For more information, refer to the aliasadm(1M) man page.

How to Add Entries by Editing an NIS+ mail_aliases Table

You can use the aliasadm command to manage entries in an NIS+ table. To add more than two or three aliases to the table, follow these instructions.

  1. Compile a list of each of your mail clients, the locations of their mailboxes, and the names of the mail server systems.
  2. Either be a member of the NIS+ group that owns the table, or become root on the mail server, or assume an equivalent role.

    Roles contain authorizations and privileged commands. For more information about roles, see Configuring RBAC (Task Map) in System Administration Guide: Security Services. To configure a role with the Primary Administrator profile, see Chapter 2, Working With the Solaris Management Console (Tasks), in System Administration Guide: Basic Administration.

  3. Display and edit the aliases table.
    # aliasadm -e

    This command displays the table and enables you to edit the table. The editor that you use has been set with the $EDITOR environment variable. If this variable is not set, vi is the default editor.

  4. Use the following format to type each alias on a separate line.
    alias: expanded-alias # ["option" # "comments"]
    alias

    This column is for the short form of the alias name.

    expanded-alias

    This column is for the expanded alias name.

    option

    This column is reserved for future use.

    comments

    This column is used for comments about the individual alias, such as a name for the alias.

    If you leave the option column blank, type an empty pair of quotation marks ("") and add the comments.

    The order of the entries is not important to the NIS+ mail_aliases table. The aliasadm -l command sorts the list and displays the entries in alphabetical order.

    For more information, refer to Mail Alias Files and the aliasadm(1M) man page.

How to Edit Entries in an NIS+ mail_aliases Table

To edit entries in the table, follow these instructions.

  1. Either be a member of the NIS+ group that owns the table, or become root on the mail server, or assume an equivalent role.

    Roles contain authorizations and privileged commands. For more information about roles, see Configuring RBAC (Task Map) in System Administration Guide: Security Services. To configure a role with the Primary Administrator profile, see Chapter 2, Working With the Solaris Management Console (Tasks), in System Administration Guide: Basic Administration.

  2. Display the alias entry.
    # aliasadm -m alias

    Replace alias with the assigned alias name.

  3. Edit the alias entry, as necessary.
    # aliasadm -c alias expanded-alias [options comments]
    alias

    If necessary, edit the alias name.

    expanded-alias

    If necessary, edit the expanded alias name.

    options

    If necessary, edit the option.

    comments

    If necessary, edit the comment for this entry.

    For more information, refer to the aliasadm(1M) man page, as well as Mail Alias Files.

  4. Display the entry that you have edited and ensure that the entry is correct.
    # aliasadm -m alias

    For more information, refer to the aliasadm(1M) man page.

Example 13-4 Deleting Entries From an NIS+ mail_aliases Table

To delete entries from the table, use the following syntax after you complete the first step in this procedure:

# aliasadm -d alias

Replace alias with the alias name for the entry that you are deleting.

How to Set Up an NIS mail.aliases Map

Use the following procedure to facilitate aliasing with an NIS mail.aliases map.

  1. Compile a list of each of your mail clients, the locations of their mailboxes, and the names of the mail server systems.
  2. Become root on the NIS master server or assume an equivalent role.

    Roles contain authorizations and privileged commands. For more information about roles, see Configuring RBAC (Task Map) in System Administration Guide: Security Services. To configure a role with the Primary Administrator profile, see Chapter 2, Working With the Solaris Management Console (Tasks), in System Administration Guide: Basic Administration.

  3. Edit the /etc/mail/aliases file, and make the following entries.
    1. Add an entry for each mail client.
      # cat /etc/mail/aliases
      ..
      alias:expanded-alias
      alias

      Use the short alias name.

      expanded-alias

      Use the expanded alias name ([email protected]).

    2. Ensure that you have a Postmaster: root entry.
      # cat /etc/mail/aliases
      ..
      Postmaster: root
    3. Add an alias for root. Use the mail address of the person who is designated as the postmaster.
      # cat /etc/mail/aliases
      ..
      root: [email protected]
      [email protected]

      Use the assigned address of the designated postmaster.

  4. Ensure that the NIS master server is running a name service to resolve the host names on each mail server.
  5. Change to the /var/yp directory.
    # cd /var/yp
  6. Apply the make command.
    # make

    The changes in the /etc/hosts and /etc/mail/aliases files are propagated to NIS slave systems. The changes are active in only a few minutes, at most.

How to Set Up a Local Mail Alias File

Use the following procedure to resolve aliases with a local mail alias file.

  1. Compile a list of each of your users and the locations of their mailboxes.
  2. Become root on the mail server or assume an equivalent role.

    Roles contain authorizations and privileged commands. For more information about roles, see Configuring RBAC (Task Map) in System Administration Guide: Security Services. To configure a role with the Primary Administrator profile, see Chapter 2, Working With the Solaris Management Console (Tasks), in System Administration Guide: Basic Administration.

  3. Edit the /etc/mail/aliases file and make the following entries.
    1. Add an entry for each user.
      user1: [email protected]
      user1

      Use the new alias name.

      [email protected]

      Use the actual address for the new alias.

    2. Ensure that you have a Postmaster: root entry.
      # cat /etc/mail/aliases
      ..
      Postmaster: root
    3. Add an alias for root. Use the mail address of the person who is designated as the postmaster.
      # cat /etc/mail/aliases
      ..
      root: [email protected]
      [email protected]

      Use the assigned address of the designated postmaster.

  4. Rebuild the alias database.
    # newaliases

    The configuration of the AliasFile option in /etc/mail/sendmail.cf determines whether this command generates in binary form either the single file, /etc/mail/aliases.db, or the pair of files, /etc/mail/aliases.dir and /etc/mail/aliases.pag.

  5. Perform one of the following steps to copy the file or files that were generated.
    1. (Optional) Copy the /etc/mail/aliases, the /etc/mail/aliases.dir, and the/etc/mail/aliases.pag files to each of the other systems.

      You can copy the three files by using the rcp or rdist commands. Refer to the rcp(1) man page or the rdist(1) man page for more information. Alternately, you can create a script for this purpose.

      When you copy these files, you do not need to run the newaliases command on each of the other systems. However, remember that you must update all the /etc/mail/aliases files each time you add or remove a mail client.

    2. (Optional) Copy the /etc/mail/aliases and the /etc/mail/aliases.db files to each of the other systems.

      You can copy these files by using the rcp or rdist commands. Refer to the rcp(1) man page or the rdist(1) man page for more information. Alternately, you can create a script for this purpose.

      When you copy these files, you do not need to run the newaliases command on each of the other systems. However, remember that you must update all the /etc/mail/aliases files each time you add or remove a mail client.

How to Create a Keyed Map File

To create a keyed map file, follow these instructions.

  1. Become superuser or assume an equivalent role.

    Roles contain authorizations and privileged commands. For more information about roles, see Configuring RBAC (Task Map) in System Administration Guide: Security Services. To configure a role with the Primary Administrator profile, see Chapter 2, Working With the Solaris Management Console (Tasks), in System Administration Guide: Basic Administration.

  2. Create an input file.

    Entries can have the following syntax.

    [email protected]   [email protected]
    [email protected]    error:nouser No such user here
    @olddomain.com          %1@newdomain.com
    [email protected]

    Use the user name that was previously assigned with the domain that is newly assigned.

    [email protected]

    Use the address that is newly assigned.

    [email protected]

    Use the user name that was previously assigned with the domain that was previously assigned.

    olddomain.com

    Use the domain that was previously assigned.

    newdomain.com

    Use the domain that is newly assigned.

    The first entry redirects mail to a new alias. The next entry creates a message when an incorrect alias is used. The last entry redirects all incoming mail from olddomain to newdomain.

  3. Create the database file.
    # /usr/sbin/makemap maptype newmap < newmap
    maptype

    Select a database type, such as dbm, btree, or hash.

    newmap

    Use the name of the input file and the first part of the name of the database file. If the dbm database type is selected, then the database files are created by using a .pag and a .dir suffix. For the other two database types, the file name is followed by .db.

Managing the postmaster Alias

Every system must be able to send mail to a postmaster mailbox. You can create an NIS or NIS+ alias for postmaster, or you can create the alias in each local /etc/mail/aliases file. Refer to these procedures.

How to Create a postmaster Alias in Each Local /etc/mail/aliases File

If you are creating the postmaster alias in each local /etc/mail/aliases file, follow these instructions.

  1. Become superuser or assume an equivalent role.

    Roles contain authorizations and privileged commands. For more information about roles, see Configuring RBAC (Task Map) in System Administration Guide: Security Services. To configure a role with the Primary Administrator profile, see Chapter 2, Working With the Solaris Management Console (Tasks), in System Administration Guide: Basic Administration.

  2. View the /etc/mail/aliases entry.
    # cat /etc/mail/aliases
    # Following alias is required by the mail protocol, RFC 2821
    # Set it to the address of a HUMAN who deals with this system's
    # mail problems.
    Postmaster: root
  3. Edit each system's /etc/mail/aliases file.

    Change root to the mail address of the person who is designated as the postmaster.

    Postmaster: mail-address
    mail-address

    Use the assigned address for the person who is designated as the postmaster.

  4. (Optional) Create a separate mailbox for the postmaster.

    You can create a separate mailbox for the postmaster to keep postmaster mail separate from personal mail. If you create a separate mailbox, use the mailbox address instead of the postmaster's personal mail address when you edit the /etc/mail/aliases files. For details, refer to How to Create a Separate Mailbox for postmaster.

How to Create a Separate Mailbox for postmaster

If you are creating a separate mailbox for postmaster, follow these instructions.

  1. Become superuser or assume an equivalent role.

    Roles contain authorizations and privileged commands. For more information about roles, see Configuring RBAC (Task Map) in System Administration Guide: Security Services. To configure a role with the Primary Administrator profile, see Chapter 2, Working With the Solaris Management Console (Tasks), in System Administration Guide: Basic Administration.

  2. Create a user account for the person who is designated as postmaster. Put an asterisk (*) in the password field.

    For details about adding a user account, refer to Chapter 5, Managing User Accounts and Groups (Tasks), in System Administration Guide: Basic Administration.

  3. After mail has been delivered, enable the mail program to read and write to the mailbox name.
    # mail -f postmaster
    postmaster

    Use the assigned address.

How to Add the postmaster Mailbox to the Aliases in the /etc/mail/aliases File

If you are adding a postmaster mailbox to the aliases in the /etc/mail/aliases file, follow these instructions.

  1. Become superuser or assume an equivalent role.

    Roles contain authorizations and privileged commands. For more information about roles, see Configuring RBAC (Task Map) in System Administration Guide: Security Services. To configure a role with the Primary Administrator profile, see Chapter 2, Working With the Solaris Management Console (Tasks), in System Administration Guide: Basic Administration.

  2. Add an alias for root. Use the mail address of the person who is designated as the postmaster.
    # cat /etc/mail/aliases
    ..
    root: [email protected]
    [email protected]

    Use the assigned address of the person who is designated as postmaster.

  3. On the postmaster's local system, create an entry in the /etc/mail/aliases file that defines the name of the alias. sysadmin is an example. Also, include the path to the local mailbox.
    # cat /etc/mail/aliases
    ..
    sysadmin: /usr/somewhere/somefile
    sysadmin

    Create a name for a new alias.

    /usr/somewhere/somefile

    Use the path to the local mailbox.

  4. Rebuild the alias database.
    # newaliases
Previous Next

 
 
  Published under the terms fo the Public Documentation License Version 1.01. Design by Interspire