Configuring and testing a BIND nameserver on Linux

Linux DNS server BIND configuration

The BIND DNS software is one of the most reliable and proven ways to configure name resolution on a Linux system. Having been around since the 1980s, it remains the most popular Domain Name Server (DNS) currently in use. This article serves as a quick configuration manual of a Linux DNS server using BIND.

This article is not an introduction to DNS or an explanation of how the protocol works. Rather we will simply concentrate on a simple configuration of a custom zone and config file for a given domain / host supporting www and mail services. Follow along with the instructions below to get BIND DNS set up and configured on your own server.

WARNING
Before you proceed with the installation and configuration of BIND nameserver, make sure that BIND DNS server is exactly what you want. Default setup and execution of BIND on Debian or Ubuntu may take around 200MB of RAM with no zones added to the config file. Unless you reduce the memory usage of a BIND via various BIND “options” config settings, be prepared to have some spare RAM available just for this service. This fact is even more important if you pay for your own VPS server.

In this tutorial you will learn:

  • How to install BIND on major Linux distros
  • How to create a DNS zone file
  • How to configure address to name mappings
  • How to check BIND zone file and configuration
  • How to start or restart the BIND DNS service
  • How to test a BIND configuration with dig command

Read more

Sharing data from the host system to a Docker container

How to share data between a Docker container and host system using volumes

The easiest way to share data between a Docker container and the host system is to use Docker’s volumes. In this guide, we will go through the step by step instructions of sharing files between a Docker container and host system using Docker volumes via the command line on Linux.

DID YOU KNOW?
Docker volumes work similarly to bind mounts, but are the preferred method for sharing data between a host system and Docker container because outside applications are not able to access the files and modify them.

In this tutorial you will learn:

  • How to use volumes to share data between a Docker container and host system

Read more

Backing up a Docker container on Linux

Docker container: Backup and Restore

The purpose of this guide is to go over the step by step instructions of how to back up a Docker container on the Linux command line. We’ll also show how to restore a Docker container from backup. This can be done on any Linux system where Docker is installed, and will work on any Linux distribution.

To understand the Docker container backup and recovery process we first need to understand the difference between a Docker image and a Docker container. A Docker image contains an operating system with possibly one or more preconfigured applications, whereas a Docker container is a running instance created from an image.

In this tutorial you will learn:

  • How to back up a Docker container on Linux
  • How to restore a Docker container on Linux

Read more

Viewing the iptables rules configured on our Linux system

Collection of basic Linux Firewall iptables rules

The purpose of this guide is to show some of the most common iptables commands for Linux systems. iptables is the firewall built into all Linux distributions. Even distros like Ubuntu, which utilizes ufw (uncomplicated firewall), and Red Hat, which utilizes firewalld still pass their commands to iptables and use it in the background.

Mastering iptables, or at least becoming familiar with some of the most basic commands, is essential for Linux administrators. Even casual Linux users can benefit from understanding the basics of the iptables firewall, since they may be required to apply some minor configurations to it at some point. Use some of the examples below to familiarize yourself with the iptables syntax and get an idea for how it works to protect your system.

WARNING
You should not apply iptables rules to a production system until you are somewhat familiar with how they work. Also be careful when applying rules to remote systems (a computer that you have established an SSH session with) because you can accidentally lock yourself out if you enter the wrong rule.

In this tutorial you will learn:

  • Collection of basic Linux firewall iptables rules
Viewing the iptables rules configured on our Linux system

Viewing the iptables rules configured on our Linux system

Read more

sudoedit

How to edit a system file with sudoedit preserving the invoking user environment

On Linux and other Unix-based operating systems, sudo is used to run a program with the privileges of another user, often root. When we need to modify a file which requires administrative privileges to be edited, if we launch our favourite text editor directly with sudo, it will run without the customization and settings we use when we invoke it normally, since the environment of the invoking user is not preserved. In this tutorial we will see how can we easily solve this problem and how we can modify system files securely by using sudoedit.

In this tutorial you will learn:

  • How to edit a system file using sudoedit
  • What are the steps performed when a file is edited with sudoedit
  • How to set the default editor used by sudo
sudoedit

Read more

Linking two Docker containers together through networking on Linux

Basic networking example on how to connect docker containers

One of the many desirable features built directly into Docker is networking. Docker’s networking feature can be accessed by using a --link flag which allows to connect any number of Docker containers without the need to expose a container’s internal ports to the outside world.

In this guide, you will learn how to network two or more Docker containers together on a Linux system through command line instructions. This will work on any Linux distribution. Check out the step by step instructions below to find out how.

In this tutorial you will learn:

  • How to network Docker containers together

Read more

Configuring an NFS server share on Linux

How to configure NFS on Linux

Sharing files between computers and servers is an essential networking task. Thankfully, NFS (Network File System) is available for Linux systems and makes the job extremely easy. With NFS properly configured, moving files between computers is as easy as moving files around on the same machine. Since NFS functionality is built directly into the Linux kernel, it is both powerful and available on every Linux distro, although the configuration can differ slightly between them.

In this guide, we’ll show how to install and configure NFS on major Linux distros, like Ubuntu and others based on Debian, and Fedora and others based on Red Hat. The configuration will involve a server (which hosts the files) and one client machine (which connects to the server to view or upload files). Follow along with the steps below to get NFS setup on your own system.

In this tutorial you will learn:

  • How to install NFS server
  • How to configure NFS server shares
  • How to connect to NFS server from client machines

Read more

Removing all Docker containers from a Linux system

How to remove all docker containers using a single command

In this guide, we will show command line examples for removing all Docker containers from a Linux system. This will work on any Linux distribution.

Along with removing Docker containers, you’ll also learn how to remove Docker images, volumes, and networks. This is useful when you want to completely purge all traces of containers from your Docker installation and start fresh. Check out the examples below to find out how.

In this tutorial you will learn:

  • How to list, stop, and remove all Docker containers
  • How to remove Docker images, volumes, and networks

Read more

Password expiration and history information on Linux

Linux – Reset password expiration, age and history

User management is an important part of Linux administration, so it’s essential to know about all the user accounts on a Linux system. Some common user administration tasks are to list users, disable a user account, or create and modify user accounts.

In this guide, we will be focusing on managing user passwords. It’s good security practice to force users to change their password every once in a while by setting passwords to expire. In the examples below, you’ll see how to reset a user’s password, set their password to expire (either instantly or in the future), and see the age of a user’s password. We’ll also see how password changes can be seen in log files, giving us some insight into user’s password change history.

In this tutorial you will learn:

  • How to set a user’s password to expire
  • How to see the age of a user’s password
  • How to see password changes in log files

Read more

Configuring the wireless interface on Ubuntu Linux

Setup Wireless interface on Ubuntu

Setting up the wireless interface on Ubuntu Linux is likely one of the first things you’ll need to do after installing the operating system and booting into it for the first time. As long as you have the proper hardware, Ubuntu can easily connect to Wi-Fi networks configured with various types of security like WEP, WPA, and WPA2.

In this guide, we will cover the step by step instructions to connect to a Wi-Fi network from the GNOME GUI (the default desktop environment) on Ubuntu. We will also show how to connect to Wi-Fi from command line, which is handy in the case of headless servers or those running without a desktop environment. Follow along with us below to find out how.

In this tutorial you will learn:

  • How to connect to Wi-Fi network in GNOME GUI
  • How to connect to Wi-Fi network via command line
  • How to enable or disable the system’s Wi-Fi adapter

Read more

How to change password and account expiry

How to change password and account expiry options on Linux using chage

Managing the period of time a password of a user should be valid and the date in which said account should expire are very important tasks a system administrator should be able to perform. While some of these parameter can be set when creating an account, it is also possible to change them at a second time, using the chage utility; in this tutorial we see how to use this utility.

In this tutorial you will learn:

  • How to get information about an user account ageing
  • How to set an account expiration date
  • How to set the minimum number of days which should pass between two password changes
  • How to set the password expiration date
  • How to set the inactive days threshold
  • How to set when a user should receive a warning about a future password expiration

Read more

Recover – Reset Forgotten Linux Root Password

The root account, sometimes called super user, is the admin account on a Linux system, and is essential for performing all kinds of administrative tasks. You’ll need access to it in order to install or remove packages, manage other user accounts, and a lot more things. Anytime you access the root account, either through the su or sudo commands, you’ll be prompted for the root password.

If you have forgotten the password to your system’s root account, you don’t necessarily have to go back to square one and reinstall the whole operating system. It’s possible to recover and reset the root password, even without the old password. In this guide, we’ll take you through the step by step instructions of recovering a forgotten root password on Linux. This will work regardless of the Linux distribution you’re running, as long as its using the GRUB bootloader. Other bootloaders will have similar instructions.

In this tutorial you will learn:

  • How to reset a forgotten root password on Linux

Read more