Book Image

Ubuntu Server Cookbook

By : Uday Sawant
Book Image

Ubuntu Server Cookbook

By: Uday Sawant

Overview of this book

Ubuntu is one of the most secure operating systems and defines the highest level of security as compared other operating system. Ubuntu server is a popular Linux distribution and the first choice when deploying a Linux server. It can be used with a $35 Raspberry Pi to top-notch, thousand-dollar-per-month cloud hardware. Built with lists that there are 4 million + websites built using Ubuntu. With its easy-to-use package management tools and availability of well-known packages, we can quickly set up our own services such as web servers and database servers using Ubuntu. This book will help you develop the skills required to set up high performance and secure services with open source tools. Starting from user management and an in-depth look at networking, we then move on to cover the installation and management of web servers and database servers, as well as load balancing various services. You will quickly learn to set up your own cloud and minimize costs and efforts with application containers. Next, you will get to grips with setting up a secure real-time communication system. Finally, we’ll explore source code hosting and various collaboration tools. By the end of this book, you will be able to make the most of Ubuntu’s advanced functionalities.
Table of Contents (20 chapters)
Ubuntu Server Cookbook
Credits
About the Author
www.PacktPub.com
Preface
Index

Adding e-mail accounts


In this recipe, we will learn how to add e-mail accounts to Postfix. The easiest way to add a new e-mail account to Postfix is to add a new user account on your server. Postfix will check for user accounts and deliver e-mails to respective users. We will create a virtual user setup so that we do not need to create user accounts for each e-mail user.

Getting ready

You will need access to a root account or an account with sudo privileges.

I assume that you have completed your basic Postfix setup and that it is working properly.

How to do it…

Follow these steps to add e-mail account:

  1. Create a new user account:

    $ useradd -s /usr/bin/nologin -m vmail
    
  2. Get the UID and GID for this account:

    $ grep vmail /etc/passwd
    vmail:x:1001:1001::/home/vmail:/usr/bin/nologin
    
  3. Create a base directory layout for domains and users:

    $ sudo mkdir -p /home/vmail/example.org/bob
    $ sudo mkdir -p /home/vmail/example.net/alice
    
  4. Allow only the user vmail to access these files:

    $ sudo chown -R vmail:vmail...