Mini-Howtos

Want to support HowtoForge? Become a subscriber!
 

On sending emails, I get the following error message: "Relaying denied".

There are two solutions for this problem:

1) You configure your MTA to allow authentication via SMTP (SMTP-Auth). Your users then have to change settings in their email clients (e.g. Outlook), i.e., they have to activate Server requires authentication.

2) You install "POP-before-SMTP" or poprelayd on your server. Your users then have to fetch emails first before they are allowed to send emails for a restricted period of time (mostly 30 min.).

How can I find out which Postfix version I'm running?

Just run

postconf -d | grep mail_version

to find out your Postfix version.

I'd like to disable the use of the exec() function in my PHP. Can this be done?

Yes, you can disable it in your php.ini. Search for the line

disable_functions =

and change it:

disable_functions = exec

Don't forget to restart Apache afterwards.

How do I find out which gateway a Linux system is currently using?

Run

route -nee

The output will look like this:

Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface    MSS   Window irtt
192.168.0.0     0.0.0.0         255.255.255.0   U     0      0        0 eth0     0     0      0
0.0.0.0         192.168.0.1     0.0.0.0         UG    0      0        0 eth0     0     0      0
0.0.0.0         192.168.0.1     0.0.0.0         UG    0      0        0 eth0     0     0      0

This means that the system with the IP address 192.168.0.100 is using 192.168.0.1 as gateway.

How do I make my MySQL server use TCP connections instead of Unix sockets?

Comment out the option skip-networking in the file my.cnf which typically lies under /etc or /etc/mysql. Then restart your MySQL server:

/etc/rc.d/init.d/mysql restart

or

/etc/init.d/mysql restart

With

netstat -ta

you can check if MySQL is reachable via TCP.

How do I restore a MySQL database from an sql dump?

If your MySQL user has a password:

mysql -h localhost -u [MySQL user, e.g. root] -p[database password] [name of the database] < [name of your sql dump, e.g. sqldump.sql]

Please note:  there's no space between -p and the password!

If there's no password:

mysql -h localhost -u [MySQL user, e.g. root] [name of the database] < [name of your sql dump, e.g. sqldump.sql]

How do I make an sql dump of a MySQL database on the command line?

If your MySQL user has a password:

mysqldump -h localhost -u [MySQL user, e.g. root] -p[database password] -c --add-drop-table --add-locks --all --quick --lock-tables [name of the database] > sqldump.sql

Please note:  there's no space between -p and the password!

If there's no password:

mysqldump -h localhost -u [MySQL user, e.g. root] -c --add-drop-table --add-locks --all --quick --lock-tables [name of the database] > sqldump.sql

Resolving domain names with dig

To resolve a domain name on the shell, you can use the command dig. Resolving the domain example.com:

dig example.com

If thedomain can be resolved, the result will be similar to this:

;  DiG 9.2.1  howtoforge.com
;; global options: printcmd
;; Got answer:
;; ->>HEADER<<- opcode: QUERY, status: NOERROR, id: 42946
;; flags: qr rd ra; QUERY: 1, ANSWER: 1, AUTHORITY: 0, ADDITIONAL: 0

;; QUESTION SECTION:
;example.com. IN A

;; ANSWER SECTION:
example.com. 84600 IN A 192.168.0.1

;; Query time: 27 msec
;; SERVER: 212.227.21.251#53(212.227.21.251)
;; WHEN: Wed Oct 26 18:53:32 2005
;; MSG SIZE rcvd: 48

To check if the local webserver is responsible for this domain use the following command:

How do I create SSL certificates with OpenSSL on the command line?

You do it like this:

openssl genrsa -des3 -passout pass:yourpassword -out /path/to/your/key_file 1024

openssl req -new -passin pass:yourpassword -passout pass:yourpassword -key /path/to/your/key_file -out /path/to/your/csr_file -days 365

openssl req -x509 -passin pass:yourpassword -passout pass:yourpassword -key /path/to/your/key_file -in /path/to/your/csr_file -out /path/to/your/crt_file -days 365

openssl rsa -passin pass:yourpassword -in /path/to/your/key_file -out /path/to/your/key_file2

chmod 400 /path/to/your/key_file2

first page
previous page
...
16
next page
last page