Posts in "Linux Help"

Qmail can’t receive any email with error 451 qmail-spp failure: plugins/chkrcptto: child crashed (#4.3.0) (in reply to RCPT TO command))

Problem:
Qmail cant receive any email.

Error:
451 qmail-spp failure: plugins/chkrcptto: child crashed (#4.3.0) (in reply to RCPT TO command))

Cause:
Device /dev/full is missing.

#ls -al /dev/full
ls: /dev/full: No suce file or directory

How to fix:
mknod -m 666 /dev/full c 1 7
chown root:root /dev/full

Check if folder exist on bash command

if [ ! -e “$BACKUPDIR/latest” ] # Check Latest Directory exists.
then
mkdir -p “$BACKUPDIR/latest”
fi

Nautilus cannot handle “computer” location on Ubuntu(Karmic Kaula)

Problem:

Last week i have experiencing error during opening Computer, Network Folders, Destop and Recycle bin on Ubuntu Karmic Kuala. And flash drive cant do the automount anymore.

The error says :

Nautilus cannot handle "computer" location

I found out that i have upgraded my glib library under /usr/local few days ago.

Solution:

Remove /usr/local
sudo mv /usr/local /usr/local.old

create /usr/local
sudo mkdir /usr/local

restart your computer.

Try to check you computer folder and its working! Good luck!

Updated: correction from Amar Patil, Thanks….

Hamachi killed after upgrading to Ubuntu 9.10

Hamachi killed after upgrading Ubuntu 9.10 (Karmic Koala). This is because hamachi executable is compressed with upx.

Steps in uncompressing Hamachi with upx

[ad#ad-2]

1. Install upx-ucl (make sure you have root or sudo privileged)

sudo apt-get install upx-ucl

2. locate hamachi executable (default installation /usr/bin)

cd /usr/bin

3. decompress hamachi

sudo upx -d hamachi

after executing this commands you will see this outputs

Ultimate Packer for eXecutables
  Copyright (C) 1996,1997,1998,1999,2000,2001,2002,2003,2004,2005,2006,2007
UPX 3.01        Markus Oberhumer, Laszlo Molnar & John Reiser   Jul 31st 2007

        File size         Ratio      Format      Name
   --------------------   ------   -----------   -----------
    830676 < -    331144   39.86%    linux/386    hamachi

Unpacked 1 file.

And now you are read to run hamachi… enjoy!

date function for bash commands

How to get date on bash/sh command?
[ad]

#!/bin/bash
# Datestamp e.g 2002-09-21_24h00m
DATE=`date +%Y-%m-%d_%Hh%Mm`

# Day of the week e.g. Monday
DATE=`date +%A`

# Day number of the week 1 to 7 where 1 represents Monday
DATE=`date +%u`

# Date of the Month e.g. 27
DATE=`date +%d`

# Month e.g January
DATE=`date +%B`

# Week Number e.g 37
DATE=`date +%V`

Account Default Page For CPANEL/WHM

How to set-up default page for cpanel account?

1. Create a default page that you want to be the default page.

2. Copy your created page to /root/cpanel3-skel/public_html/

That’s all! Every time you create an account on WHM your default page will be create on accounts public_html folder.

For reseller accounts that don’t have root privileged, you should have /cpanel3-skel/ directory on your main account you can add public_html folder their.

Recovering from a forgotten root password

To perform a system administrator task, you have to know the root password. What happens if you forgot your root password? Not to worry. Just reboot your PC and you can reset the root password by following these steps:

  1. Reboot the PC(select reboot as you log out the of the GUI) or power up a usual.

    Soon you see the graphical boot loader on screen that shows the name of the operating systems you can boot. If your system runs with LILO boot loader, press Ctrl+X and at the boot prompt type linux single and press enter. Then proceed to step 4.

    [ad#squere-ads]

  2. If you have more than one operating system installed, use the arrow key to select linux as operating system, then press the A key.
  3. GRUB prompts you for commands to add to its defualt boot command.

  4. Press the spacebar, type the following, and press enter:
  5. single

    Linux starts up as usual but runs in a single-user mode that do not require you to log in. After linux starts, you will see the following command line prompts that ends with a hash mark (#), similar to the following :

    sh-2.05b#

  6. Type the paswrd command to change the root password as follows:
  7. sh-2.05b# passwd
    Changing password for root user.
    New password:

  8. Type the new root password that you want to use (it doesn’t appear on screen) and then press enter.
  9. Linux asks for the password again, like this:

    Retype new password:

  10. Type the new password again, and press enter.
  11. If you enter the same password both times, the passwrd command changes the root password.

  12. Now type reboot to reboot the PC.
  13. After linux starts, it displays the familiar login screen. Now you can log in as root with the new password

[ad#squere-ads]

Resetting Mysql root Password

‘Like locking your keys in the car, to forget your password after
you’ve spent an hour installing and tweaking a new MySQL server can be
an embarassment to say the least.’
[ad#squere-ads]
Fortunately, if you have root access to that computer, all in NOT lost.

Here are the steps when you found yourself in this situation.

1. Kill the server process.
% kill pid
(where pid is the process id. Do not use kill -9 unless absolutely
necessary, as this may damage your table files)

2. Run safe-mysqld with the –skip-grant-tables command line option.
(This instructs the MySQL server to allow unrestricted access to
anyone) NOTE: restrict all remote access before issuing this command
% safe-mysqld --skip-grant-table

3. Change root password
mysql > use mysql;
mysql > update user set password = password('newpassword') where user
= 'root';

[ad#squere-ads]
4. Disconnect and instruct the mysql server to reload the grants
tables to begin requiring passwords.
% mysqladmin flush-privileges

“That does it — and nobody ever has to know what you did. As for
locking your keys in your car, you’re on your own there.”

Must have for php-mysql beginners developers.

Installing RoundCube in cPanel

First make sure you know your mysql root password, you have to replace DATABASEPASSWORD to your mysql root password.

If you have already used RoundCube installation please make sure you remove any traces of it with,


cd /usr/local/cpanel/base
rm -rf roundcube*
mysql -p -e 'drop database roundcube';
chattr -i /usr/local/cpanel/base/frontend/x/webmaillogin.html
chattr -i /usr/local/cpanel/base/webmaillogin.cgi
/scripts/upcp

[ad#squere-ads]

You will have to specify your root password when prompted.

Now lets download roundcube first and chmod the directorys


cd /usr/local/cpanel/base
wget -O roundcube.tar.gz http://heanet.dl.sourceforge.net/sourceforge/roundcubemail/
roundcubemail-0.1-rc1.tar.gz
tar -zxvf roundcube.tar.gz
rm -rf roundcube.tar.gz
mv -f roundcubemail-0.1-rc1 roundcube
cd roundcube
chmod -R 777 temp
chmod -R 777 logs

Create the database and install the intial sql file. The following commands will do this for you.


mysql -e "CREATE DATABASE roundcube;" -pDATABASEPASSWORD
mysql -e "use roundcube; source SQL/mysql.initial.sql;" -pDATABASEPASSWORD

Now lets sort out the configuration


cd config
mv db.inc.php.dist db.inc.php
mv main.inc.php.dist main.inc.php

Now open db.inc.php

nano db.inc.php

Find


$rcmail_config['db_dsnw'] = 'mysql://roundcube:pass@localhost/roundcubemail';

Replace with


$rcmail_config['db_dsnw'] = 'mysql://root:DATABASEPASSWORD@localhost/roundcube';

Now Open main.inc.php

nano main.inc.php

Find


$rcmail_config['default_host'] = '';

Replace with


$rcmail_config['default_host'] = 'localhost';

Now we have to configure cPanel to show roundcube in the theme. Please note this is for the X theme(default) only!! If you use another theme please skip the next part and see below.


cd /usr/local/cpanel/base/roundcube/skins/default/images/
cp --reply=yes roundcube_logo.png /usr/local/cpanel/base/frontend/x/images/roundcube_logo.png
cp --reply=yes roundcube_logo.png /usr/local/cpanel/base/webmail/x/images/roundcube_logo.png
cd /usr/local/cpanel/base
wget http://www.hostgeekz.com/files/hostgeekz/HGpatch-roundcube-0.1-rc1
patch -p0 < HGpatch-roundcube-0.1-rc1

**NOTE** If you receive a message stating

Reversed (or previously applied) patch detected! Assume -R?

please press N for No as this is because you previously installed roundcube

This will auto do all the necessary changes to roundcube and the X theme.

Once the patch is executed you may now access roundcube via http://yourip/webmail

—–

If you do not use the X theme please do the following


cd /usr/local/cpanel/base
wget http://www.hostgeekz.com/files/hostgeekz/HGpatch-roundcube-NON-X-0.1-rc1
patch -p0 < HGpatch-roundcube-NON-X-0.1-rc1

Then open your webmaillogin.html, please replace YOURTHEME with the name of your theme.


nano /usr/local/cpanel/base/frontend/YOURTHEME/webmaillogin.html

and find

Add Below


RoundCube——

***UPDATE***
Remember to chattr +i the files or add the patch to your /scripts/upcp.


chattr +i /usr/local/cpanel/base/frontend/x/webmaillogin.html
chattr +i /usr/local/cpanel/base/webmaillogin.cgi

If you are using cPanel 11 ensure to run the following fix.


wget http://www.hostgeekz.com/files/hostgeekz/cpanel-11-fix.sh
chmod 700 cpanel-11-fix.sh
./cpanel-11-fix.sh
rm -f cpanel-11-fix.sh

That’s it! You may now access roundcube via http://yourip/webmail

Alternative for rm command

Ive been handling webserver with more than 1000 website and lots of unique visitors per month. Session are stored on the server hard drive and every end of the month i need to clean it up.

Now i was puzzled by rm command.
rm -f *

in /tmp/ directory. The terminal choked and gave out:

-bash: /bin/rm: Argument list too long

Apparently there are a maximum number of files that can be passed to rm.

ls -1 | grep sess | wc -l

382611

[ad#squere-ads]

wow 382611 session files! image how long it would take if you have an application that running with sessions.
The solution for this problem would be :

find . -name 'sess*' | xargs rm