Archive for the ‘Linux’ Category

How to setup a personal mail server with Postfix and Dovecot

May 21st, 2013 Comments off

The instructions were tested on Fedora 17, most RedHat distributions should be very similar and it should at least give you an idea for other distros.

Install the required software:

# yum install postfix dovecot

Check that Postfix supports Dovecot SASL:

# postconf -a

Edit /etc/postfix/, add at the top of the file:

inet_interfaces = all
# list of domains receiving mails on this server, remember to set the MX record in their DNS
virtual_alias_domains =,
virtual_alias_maps = hash:/etc/postfix/virtual
mynetworks_style = host
# add the ips that are always allowed to relay to mynetworks list
mynetworks =
# use reject_rbl_client to specify RBLs (simple anti-spam measure)
smtpd_recipient_restrictions =

smtpd_sasl_type = dovecot
smtpd_sasl_path = private/auth
smtpd_sasl_auth_enable = yes

Create/edit /etc/postfix/virtual and add a couple of email aliases: myaccount myaccount

Compile the aliases table:

# postmap /etc/postfix/virtual

Restart the postfix service, for minor changes in the configuration file you can also use:

# postfix reload

Uncomment the postfix smtp-auth settings in /etc/dovecot/conf.d/10-master.conf

# Postfix smtp-auth
unix_listener /var/spool/postfix/private/auth {
mode = 0666

Edit /etc/dovecot/conf.d/10-mail.conf and set mail_location:

mail_location = mbox:~/mail:INBOX=/var/mail/%u

Restart dovecot.

This should be enough for a couple of email accounts for your domains, accessible by POP3 and IMAP.

Categories: Linux Tags: , , ,

Which package owns a file?

January 2nd, 2011 Comments off

Sometimes you wonder which package installed a file. There is a simple way to do this on RPM based systems. Unfortunately, I tend to forget it so I will post it here.

# rpm -qf /usr/bin/od

… and to get more info about the package:

[root@iweb ~]# yum info coreutils
Loaded plugins: fastestmirror, presto
Loading mirror speeds from cached hostfile
 * fedora:
 * updates:
Installed Packages
Name        : coreutils
Arch        : i686
Version     : 8.5
Release     : 7.fc14
Size        : 12 M
Repo        : installed
From repo   : updates
Summary     : A set of basic GNU tools commonly used in shell scripts
URL         :
License     : GPLv3+
Description : These are the GNU core utilities.  This package is the combination
            : of the old GNU fileutils, sh-utils, and textutils packages.
Categories: Linux Tags: ,

How to reset the MySQL root password

December 30th, 2010 Comments off

The MySQL server root password is not used very often and you can forget it or you inherit some already setup system and you do not have the MySQL root password. Technically, there is no way to recover the password but you can reset it.

The main inconvenience is that you have to stop the database server twice. The following instructions were tested on a Fedora Linux distribution but the main idea can be used on different operating systems, including Windows.

The main idea is to restart the mysql server without security, change the root password and restart again in normal mode. I recommend not doing this on a live server but if you already need this than there is a big sign that your system design has some issues.

First, stop the mysql server:

# service mysqld stop

Start the server with an option that enables anyone to connect without password.

# mysqld_safe --skip-grant-tables &

Wait for the mysql server start, you will get some info about it:

101230 20:00:03 mysqld_safe Logging to '/var/log/mysql/error.log'.
101230 20:00:03 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql

Connect as root without the need for a password:

# mysql -u root
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 3
Server version: 5.1.52-log Source distribution

Copyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
This software comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to modify and redistribute it under the GPL v2 license

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

Let’s say that you want to use the password “NEWPASS”, in the mysql prompt type:

mysql> use mysql;
mysql> update user set password=PASSWORD("NEWPASS") where User='root';
mysql> flush privileges;
mysql> quit

Restart the mysql server to use the new password:

 # service mysqld restart 

Now you have your regular database server with a shiny new root password. Do not forget it!

Categories: Linux, Software Tags: ,

Quick Fix for the Fedora DNSSEC Issue

June 26th, 2010 3 comments

After a routing update, Fedora 12 has some problems with the DNS service. The named service fails to start with with the following error:

Error in named configuration:
/etc/pki/dnssec-keys//named.dnssec.keys:1: open: /etc/pki/dnssec-keys//production/bg.conf: file not found

The update was not a fortunate one and an official fix will probably be issued soon. A quick way is to disable the DNSSEC options in named. Edit /etc/named.conf and comment the following lines:

dnssec-enable yes;
dnssec-validation yes;
dnssec-lookaside . trust-anchor;

and at the bottom:

include "/etc/pki/dnssec-keys//named.dnssec.keys";
include "/etc/pki/dnssec-keys//dlv/";

The DNSSEC features ads digital signatures to your DNS queries. If you need this, keep searching for other solutions.

Categories: Linux Tags: , , ,

Simple Web Server

May 26th, 2010 Comments off

If you need a very simple web server to transfer some files you can run:
python -m SimpleHTTPServer 80
and you will create a simple web server serving files from the current directory.

Categories: Linux Tags:

Strange ArchLinux Error

May 25th, 2010 Comments off

Arch Linux is a lightweight and simple distribution as they claim on the website. I am interested in a rolling release system without the headaches of Gentoo. The first setup was strange, I have no problems with an ugly console GUI but the entire experience was counterintuitive.

On example that gave me some headaches was at “Configure System” step. There was a strange error “Failed to import current network settings into target system” and all configuration files were empty. It took me sometime to figure the cause and here is this post in case somebody else has this problem. There was an error downloading one of the packages (dhcpd) and the setup program just continued without a proper notification. To recover from this you have to go back to the “Install Packages” step (only the missing packages are downloaded) until everything is downloaded.

There were a lot of small things that added up and in the end too many headaches just for a basic setup. I will check it again in after some time passes and maybe it will get better.

Categories: Linux Tags: ,