Archive for the 'Linux Support' Category

Script for deleting all the mails in Qmail

1. create a file with the following statements, say delqmail

service qmail stop
find /var/qmail/queue/mess -type f -exec rm {} \;
find /var/qmail/queue/info -type f -exec rm {} \;
find /var/qmail/queue/local -type f -exec rm {} \;
find /var/qmail/queue/intd -type f -exec rm {} \;
find /var/qmail/queue/todo -type f -exec rm {} \;
find /var/qmail/queue/remote -type f -exec rm {} \;
service qmail start

You may also include the directories like /var/qmail/queue/mess/bounce… etc.

2. Give executable permission to this file

chmod 755 delqmail

3. Execute the script

sh -x delqmail
SBDavid

How to change SMTP port in postfix

How to change SMTP port in postfix

The default SMTP port is 25. In Postfix we can change it to some other port (say 6000) using the following steps.

Open the file master.cf.

$ vi /etc/postfix/master.cf

Add the following line to the file.

6000 inet n - n - - smtpd

Restart postfix.

$ /etc/init.d/postfix restart

You can check the connection to the new port using telnet. Also make sure that the new port is not blocked in the server firewall.

/etc/rndc.key:1: configuring key ‘rndc-key’: bad base64 encoding

This error is due to the mismatch of the secret key in /etc/rndc.conf and the include file /etc/rndc.key. Both the keys should be the same.

After copying the secret key from the file /etc/rndc.conf to /etc/rndc.key, named can be restarted successfully.

root@host [~]# service named restart

Now named status can be checked

root@host [~]# service named status

How to Change Hostname in a Debian Server?

Changing the Hostname in a Debian Server

Debian based systems use the file /etc/hostname to read the hostname of the system at boot time and set it up using the init script /etc/init.d/hostname.sh. So on a Debian based system we can edit the file /etc/hostname and change the name of the system and then execute the following, to make the change active.

/etc/init.d/hostname.sh start

The hostname saved in this file (/etc/hostname) will be preserved on system reboot (and will be set using the same script used hostname.sh).

SBDavid

Remote access to pgsql database

Remote access to pgsql database.

In order to access the pgsql database remotely, you need to make following changes in the server.

1) Open the Port 5432 in the server.

iptables -A INPUT -p tcp –dport 5432 -j ACCEPT
service iptables restart

2) Edit the Pgsql configuration file (postgresql.conf).

vi /var/lib/pgsql/data/postgresql.conf

Make the following changes

tcpip_socket = true
port = 5432

3) Edit PostgreSQL HOST ACCESS CONTROL FILE ( pg_hba.conf)

This file controls what hosts are allowed to connect to what databases and specifies some options on how users on a particular host are identified. It is read each time a host tries to make a connection to a database.

vi /var/lib/pgsql/data/pg_hba.conf

Add the machine IP address from which database is accessing remotely.

# TYPE DATABASE IP_ADDRESS MASK AUTH_TYPE
AUTH_ARGUMENT

local all trust
host all 127.0.0.1 255.255.255.255 trust
host all 192.168.0.1 255.255.255.255 trust

Second line allows any user on the local system to connect to any # database under any username.

Here the IP address 192.168.0.1 has been added, to allow users from 192.168.0.1 host to connect to any database.

« Prev - Next »