Author Archive

Monday, October 13th, 2008 | Author: Angelo

Internal server error
Could not fetch uid or gid for : cpanel-phpmyadmin

Verify user cpanel-phpmyadmin exists by command
[root@server ~]#grep cpanel-phpmyadmin /etc/passwd

If it doesn’t exist then add user cpanel-phpmyadmin
useradd cpanel-phpmyadmin -d /var/cpanel/userhomes/cpanel-phpmyadmin

Now, assign appropiate ownership to /var/cpanel/userhomes/cpanel-phpmyadmin
chown cpanel-phpmyadmin.cpanel-phpmyadmin /var/cpanel/userhomes/cpanel-phpmyadmin -R

Restart mysql and try once again to access phpmyadmin.

Monday, October 13th, 2008 | Author: Angelo

Child pid x exit signal File size limit exceeded:

The error is cause of File size limit. With 32 Bit system apache support max filesize upto 2GB. If any file accessed/required by apache exceeds this limit, you will get above error. You can check for the file under “/usr/local/apache/domlogs“. To sort all files under this directory by size use command ls -lSh | more. Once you get the file with size 2 GB simply recreate and assign appropriate ownership to the same.

Monday, October 13th, 2008 | Author: Angelo

lowest numbered MX record points to local host

Generally you will get error lowest numbered MX record points to local host if entry for that domain doesn’t exists under /etc/localdomains or hostname is missing from localdomain simply adding it in localdomain will fix the issue. In case, if domains MX record is pointing to remote mail server then remove domain from localdomain and add it in /etc/remotedomains.

Sunday, October 12th, 2008 | Author: Angelo

Hello,

Change default text editor on linux server.

A. How to find default text editor of linux machine ? — >> You can determine default editor of linux machine from variable EDITOR.

Following command will show default text editor.
root@server [~]#echo $EDITOR
pico

This means default text editor of your linux machine is pico if you want to change it temporary to vi then simply execute following command.

root@server [~]#EDITOR=vi
In case, you want to change default text editor permanently to emacs then edit /root/.bashrc at the bottom of file add line.
export EDITOR=emacs

To, verify is it changed permanently or not, simply logout and login again and execute command.

root@server [~]#echo $EDITOR
emacs

EDITOR variable contains all capital letter because it is system variable. You can find all system variables and it’s value by command env .

root@server [~]#env
It will show all environment variables (system variables).

Sunday, October 12th, 2008 | Author: Angelo

Disable directory listings using .htaccess.

If you want to disable directory listing for any folder then simply create one file as .htaccess in that directory & insert rule IndexIgnore * in that file.

IndexIgnore * means directory will not list any file or folder. If you want to disable listing of .jpg files only then rule would be IndexIgnore *.jpg with this rule directory will list all files and folders excluding files with extension .jpg.

Thursday, October 09th, 2008 | Author: Angelo

Bash shell is command language interpreter which read commands from the standard input or from a file and executes it. Shell scripting is useful tool when someone need to run multiple commands on shell repeatedly. In simple words shell scripting is defining all commands with or without conditions in a file and execute the same file as command.

Sample shell script with name bashscript is given to generate message “Welcome to shell scripting world.”

A. Edit a file using vi editor and add following lines in it.

[Linux server]#vi bashscript

!#/bin/bash
echo "Hi, This is my first shell script"

B. Make the script executable.

[Linux server]#chmod u+x bashscript
Or
[Linux server]#chmod 700 bashscript

C. Executing shell script.

[Linux server]#./bashscript

How to execute shell script as command ?
Just upload bashscript in any directory defined in the environment variable PATH. You can check directories defined in environment variable PATH using command.

[Linux server]#echo $PATH

Now on shell type script name on hash prompt and hit the enter. And you have execute shell script as command.
[Linux server]#bashscript

Script is executed as command.

If you have any question or need any shell script you can query the same as comment for this post. I will update your query or shell script in comment or will write post for the same asap.

Category: shell  | Tags: , , ,  | 2 Comments
Wednesday, October 08th, 2008 | Author: Angelo

Hello,

Below is command to find out number of connections from each ip to server using netstat , sort, uniq, awk.

netstat -anp |grep 'tcp\|udp' | awk '{print $5}' | cut -d: -f1 | sort | uniq -c | sort -n

Here is description of Grep used in this command :: Grep is used for sorting lines which are matching for defined pattern but if you want to sort such lines which are matching two or more different pattern then simply define all patterns in single quote and separate them using \| .

Tuesday, October 07th, 2008 | Author: Angelo

Here is example of rsync command which is used to to delete all files from receiver server which are not exist on sender server.

rsync -e 'ssh -p 4000' -av --delete --progress ./path-to-sender-directory ip-of-remote-server:/path-of-receiver-directory/

Below is description of all parameters used in this command. Rsync stands for remote synchronization, -e to specify remote shell here remote shell we have used is ssh (secure shell running on port 4000), 'ssh -p 4000' consider secure shell ssh is configured on port 4000 on remote server, -a (stands for rpogDtH) & -v for verbose if you are using this command in script then you don’t need to define v, –delete to delete files that does not exist on sender.

./path-to-sender-directory path to sender directory, path to receiver directory username@ip-of-remote-server:/path-of-receiver-directory/ . Also you can use –progress it will show you progress during transfer(don’t use this parameter if you are using this command in shell script).

Also you can use –delete-after instead of –delete so files will be deleted from receiver after transfer not before but it would be better to use –delete because –delete does file deletions on the receiving side before transferring files to try to ensure that there is sufficient space on the receiving filesystem.

In addition there is one more option you can use –delete-excluded this will delete excluded files on receiver, this tells rsync to also delete any files on the receiving side that are excluded (In short you can use this parameter instead of –delete & –excluded).

Monday, October 06th, 2008 | Author: Angelo

Hello,

cPanel tomcat shows directory listing when someone access their site on tomcat port 8080. It is not possible to disable directory listing via .htaccess although tomcat is running on apache port 80. You can disable it on tomcat server by making following changes to web.xml file.

Edit web.xml located in tomcat conf directory and search for line <param-name>listings</param-name> below this line you will find one more line as <param-value>true</param-value> change the value true to false and restart tomcat service and you have disabled directory listing for your tomcat server.

Saturday, October 04th, 2008 | Author: Angelo

Hello,

While starting apache service on cPanel server if you are getting as given below.

(98)Address already in use: make_sock: could not bind to address 0.0.0.0:80 or 443
no listening sockets available, shutting down
Unable to open logs

Then it is because httpd is stopped but http port 80 or 443 are still engaged with other service such as exim or mysql. In such case you need to execute following command to find with which service apache port is engaged.
netstat -nap | grep 0.0.0.0:80 or netstat -nap | grep 0.0.0.0:443

For example :: In output if you found exim ( tcp 0 0 0.0.0.0:80 0.0.0.0:* LISTEN 789/exim)
To fix this issue you need to simply restart the exim service on server .