Understanding file permissions and ownership on Linux

75 views

bash

Overview

The Linux filesystem is based on a hierarchical directory structure where the root mount point is defined by the ‘/’ symbol. In fact everything is a collection of files (files, directories, partitions, pipes, sockets, and hardware devices). Directories are used as containers that list other files. Most Linux distributions follow the Filesystem Hierarchy Standard (FHS) for organizing the filesystem structure. Permissions are used to control who can read, write and execute the contents of a file, and ownership indicates to which username and group a file belongs. If you are working as a system administrator, assigning incorrect permissions or ownership can have serious consequences in terms of security. In this article I will explain the theory and show you how to manipulate them using some practical examples.

Continue reading…

Configuring OpenDKIM to sign Postfix emails

361 views

mail

Overview

DomainKeys Identified Mail (DKIM) is a method used by modern MTAs which allows an organization to sign own emails before delivery. The main purpose of DKIM is to help fight spam by associating a domain name with an mail message. DKIM uses public-key cryptography which allows the sender to electronically sign his emails in a way that can be verified by recipients. The DKIM public key is stored in DNS in order to let receivers verify both the origin and integrity of a message and the private key is used to sign each outgoing message. The DKIM signature is added as a field to the message’s header before delivery. In this article we will implement mail signing using OpenDKIM on Debian Wheezy although this configuration should run fine on any Linux distribution.

Continue reading…

Creating and using swap partitions on Linux

71 views

Linux

Overview

Swap space represents an area on the physical disk (usually a dedicated partition) which holds temporarily a process memory image. This area is often called virtual memory because it allows processes to use memory beyond the physical RAM available on your computer. Swapping and paging algorithms allow processes or portions of processes to move between physical memory and a mass storage device. This frees up space in physical memory.

As the swap space is stored on the disk the access times tend to be slow compared to the RAM. In Linux we can have two types of swap space: a dedicated partition on the physical disk or a swap file which resides among other files on the filesystem. Linux kernels newer that 2.4.10 allow 32 swap areas.

Continue reading…

Customizing and colorizing Linux bash prompt

74 views

bash

Overview

Sometimes you get bored with the way the bash prompt looks like and you want to customize it by adding some useful features or changing colors. The default Bash prompt usually ends with a dollar sign $. Bash itself will show its major and minor version (\s-\v\$), for example, bash-3.00$. Most Linux distributions redefine the prompt to include additional information, such as your current login and computer, which is useful when you’re moving between accounts and computers. In order to customize the bash prompt we need to modify the $PS1 and $PS2 environment variables by our desire.

Bash will use the value of the $PS1 variable for your main prompt. If you include variable names in the string, Bash will substitute the value of the variables into your prompt. Bash has a PS2 (prompt string 2) variable, which is the prompt for incomplete command lines such as when you use a multiline quotation. By default, this prompt is a greater-than sign (>).

Continue reading…

Customize bash history in Linux

85 views

bash

Overview

If you are a fan of the bash prompt and you have used Linux for some time it is quite likely that you have used the history command in your daily work. This command is used to recall previously entered commands at the bash prompt. This is an important feature of bash which could save you a lot of time for example if you type really long commands. By default the history option in bash is enabled. If somehow the option is not active you could turn it on by running the following command:

Continue reading…

Page 1 of 212