Archive for the ‘Linux & Unix’ Category
Get the disk health status with SMART monitor tools on Debian and Ubuntu Linux
Every modern disk has a internal monitoring function called SMART that keeps track on errors in that disk. There is a software package called smartmontools on Linux which can be used to query the SMART status of the disk to monitor if the disk might fail in near future.
Installation
apt-get install smartmontools
Usage
First we need to know the internal device name of the harddisks. For the first SATA disk, this is normally /dev/sda, the second is /dev/sdb etc. If you are unsure about the device names of your computer, then you can get them with:
fdisk -l
The command lists the partitions e.g. /dev/sda1. To get the device name, use the partition name without the number, e.g. the device of partition/dev/sda1 is /dev/sda.
To get a summary of the healt status of the disk, run:
smartctl –health /dev/sda
replace /dev/sda with the device name of the harddisk that you want to query.
The output will look similar to this:
~# smartctl --health /dev/sda smartctl version 5.38 [x86_64-unknown-linux-gnu] Copyright (C) 2002-8 Bruce Allen Home page is http://smartmontools.sourceforge.net/ === START OF READ SMART DATA SECTION === SMART overall-health self-assessment test result: PASSED
To get the full detailed output of all parameters, use this command:
smartctl –all /dev/sda
Update to latest Spamassassin filter rules in ISPConfig 2
The ISPConfig 2 controlpanel installs its own copy of Spamassassin in the folder /home/admispconfig/ispconfig/tools/spamassassin . To update the Spamassassin filter rules in ISPConfig 2, run this command as root user:
/home/admispconfig/ispconfig/tools/spamassassin/usr/bin/sa-update
To test if Spamassassin works with the new ruleset, run this command:
/home/admispconfig/ispconfig/tools/spamassassin/usr/bin/spamassassin –lint
If it does not return an error message, then Spamassassin is working correctly.
Webalizer: Error Opening file /usr/share/GeoIP/GeoIP.dat on Debian Linux
The webalizer package in Debain 6 has currently small bug as the required package for the GeoIP database is not installed automatically when webalizer is isntalled. The symptoms are that webalizer statistics are not created and this error message is displayed when webalizer is run:
Error Opening file /usr/share/GeoIP/GeoIP.dat
The solution is to install the missing package manually:
apt-get install geoip-database
Send all outgoing email trough one IP address in postfix
When a server has more then one IP address, then postfix will use all IP addresses randomly to send out emails. This can cause your emails to be listed as SPAM on other servers because the sending IP does not match the reverse IP of the server hostname. The solution is to bind postfix to the primary IP address of the server.
Edit the postfix main.cf file:
vi /etc/postfix/main.cf
and add the line:
smtp_bind_address = 192.168.0.1
were 192.168.0.1 has to be replaced with the primary IP address of the server. Then restart postfix:
/etc/init.d/postfix restart
Install GNOME Desktop On Ubuntu 11.10
If you would like your Ubuntu 11.10 better with the old GNOME desktop (no launcher but a good old system panel and so on), you can just install the gnome package and choose it as your default desktop environment. Therefore open a terminal and enter:
sudo apt-get install gnome
During the installation there will be some prompts that you will have to answer. Click OK on the first one after you are done reading:
Next, you will have to decide which desktop environment you want to configure as your default:
After installation, the GNOME as well as the Unity desktops will be available on the cogwheel-button in the login-screen:
Unpack Compressed Files with WinRar
While working with your computer you surely have come across files in the .zip or .rar format. These are so called packed or compressed files, their function is to store multiple files and/or folders into one single file and compress them so they are easier to send and waste less space. Windows has a built-in function to pack and unpack files: to compress files, just right-click them and select Send to > Compressed (zipped) folder. To uncompress, right-click the zipped file, select Extract all… and choose a directory where to put the uncompressed folder. However there is a more powerful tool called WinRar which is easy to handle, has a bunch of useful functions and also supports another compressing format, .rar which is safer than zipped compression if provided with a password. WinRar is downloadable for free as a 30-day trial version and reminds you to buy the full version after 30 days but is still usable then. You can download the appropriate version for your system here:
http://www.win-rar.com/download.html
Double-click the downloaded file and click Install on the appearing window. The next window displays WinRar’s configuration. The checkbox-filled panel on the left determines which formats your computer is supposed to open with WinRar. Usually all predefined settings should be alright, so click on OK.
On the next screen, click on Done to finish installation. Nearly all compressed files are now being associated with WinRar and have adopted its icon:
Uncompress files associated with WinRar by double-clicking them and drag-and-dropping its content anywhere on the screen or clicking on Extract To and choosing the target directory.
To compress files, just select the ones you want, right-click them and choose to either compress them to a .rar archive immediately or to add them to another archive (.zip or whatever you want) with more detailed options.
Fix for Courier IMAP Error: check for configuration errors with the FAM/Gamin library
I’ve got the following error message on Debian Linux (6.0) with Courier IMAP server:
Filesystem notification initialization error -- contact your mail administrator (check for configuration errors with the FAM/Gamin library)
when I tried to access a IMAP share. The resaon for the problem seems to be that the “fam” package was not working correctly. The solution is to install the gamin package which can replace fam in a courier setup:
apt-get install gamin
Dont worry when you get a message from apt that libfam0 gets uninstalled but is required by courier. This had no geative effects on my server.
Get the name of the newest file in a directory on the linux shell
If you have a directory with many files (a few thousand in my case) and need to know which one is the newest, then the following command might be useful. It returns the name and details of the newest file in a directory where it is executed:
ls -tl | sed -n 2p
Fix for OpenSuSE error: postfix/master: fatal: 0.0.0.0:smtps: Servname not supported for ai_socktype
You might see the error:
postfix/master[5309]: fatal: 0.0.0.0:smtps: Servname not supported for ai_socktype
On a OpenSuSE server when you enable smtps in postfix master.cf file. The reason for the error is that the definition of the smtps port in /etc/services is missing.
Solution
Edit the /etc/services file
vi /etc/services
and add the following lines:
smtps 465/tcp # Secure SMTP
smtps 465/udp # Secure SMTP
Then restart postfix
/etc/init.d/postfix restart







