Mini-Howtos

Want to support HowtoForge? Become a subscriber!
 

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

How do I start the X server in Suse 9.2 when the graphic card is working work in text mode?

To start the X server from a text mode session, execute the command:

startx

How do I find out if a remote system is still alive, if certain services are running, which processes are running, etc.?

You can use ping to see if the system is alive:

ping -c4 <system's IP address>

To see if a certain service is still alive, use the telnet command:

telnet <system's IP address> 25 (for SMTP)

telnet <system's IP address> 80 (for HTTP)

telnet <system's IP address> 110 (for POP3)

You can login to the system using SSH (port 22) (use PuTTY if you are on a Windows PC; PuTTY is an SSH client for Windows), and when you are on the system, you have a few useful tools to gather more information:

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