Archive for the Category »Basic Linux «

How to define iptables rules save option?

iptables creating rules after restarting the iptables. When iptables service is restarted settings from /etc/sysconfig/iptables file are applied and used with the iptables.

You can either set up iptables rule so that current stat is saved the rule upon restart or stop/start:

You need to make changes in following file as per your requirement for values received in following GREP result.

root@server[~]# grep IPTABLES_SAVE /etc/sysconfig/iptables-config
IPTABLES_SAVE_ON_STOP=”no”
IPTABLES_SAVE_ON_RESTART=”no”
IPTABLES_SAVE_COUNTER=”no”

Or overwrite current settings with iptables-save to /etc/sysconfig/iptables file:

root@server[~]# iptables-save > /etc/sysconfig/iptables

Note : Its always good if we use NO option for following options because some time due to wrong rule we face major problem to access server.

IPTABLES_SAVE_ON_STOP=”no”
IPTABLES_SAVE_ON_RESTART=”no”
IPTABLES_SAVE_COUNTER=”no”


PHP Parse error: syntax error, unexpected T_STRING?

If you receive following error in the error logs

” PHP Parse error: syntax error, unexpected T_STRING”
Then you can add following line in the .htaccess file

php_flag short_open_tag X

Or

If your server is SuExec enabled then you can use following code in php.ini file
short_open_tag = X

How to parse php pages in html page?

You can use following code in .htaccess file to parse php pages in html pages

RemoveHandler .html .htm
AddType application/x-httpd-php .php .htm .html

To can check above code is working ir not? by creating one test page with following code

root@gunjan[~]#pico test.html

< html>
< head>
< body>
< h1>
< ?php echo "WORKING FINE!"; ?>
< /h1>
< /body>
< /html>

How to check user who are using boxtrapper?

Now a days boxtrapper is cause high server load in that case we need to check how many users are really using boxtrapper.You can use following simple command to heck the boxtrapper users.

root@gunjan[/home]#find /home/*/etc -iname .boxtrapperenable

Run above command in /home and you will found out all the users who are using boxtrapper

Category: Basic Linux  Tags: , ,  Comments off

How to change nobody ownership to cpanel user?

First you need to found nobody users files than change it to cPanel main user name so that you can change/edit the files without any problem.But its difficult to check ownership one by one for all files in that case you can use following single command

root@gunjan[/home/test]#find ./ -user “nobody” | xargs chown test.test

In above command find will check all files owned by nobody user and after that it chown will change the ownership to test.test where test is cPanel user name

Category: Basic Linux  Tags: , ,  Comments off

htaccess pcfg_openfile unable to check htaccess file (403 error)

If you are receiving 403 error message after browsing your domain than check the Apache error logs.

root@gunjan[~]tail -f /usr/local/apache/logs/error_log

[Tue Nov 17 19:38:32 2009] [crit] [client 192.168.0.2] (13)Permission denied: /home/admin/public_html/.htaccess pcfg_openfile: unable to check htaccess file, ensure it is readable

As per above logs it seems that the nobody user is not getting read and executing permission upto any of that folder.So make sure that the public_html and the subdomain are set read and executing permission for nobody user.

How to generate the password from shell (SSH)?

If you use SSH, use mkpasswd command for creating passwords…

root@gunjan[~]#mkpasswd -l 10 -d 3 -C 3 -s 2
L]4P@V6ii3

How to change timezone on Linux server?

You can change the time zone for your server by using following command.

root@gunjan[~]#date

Wed Nov 11 19:30:29 EST 2009

For example we are changing time zoneĀ  from EST to GMT.

root@gunjan[~]#ln -sf /usr/share/zoneinfo/GMT /etc/localtime

root@gunjan[~]#date

Thu Nov 12 00:31:36 GMT 2009

Mailman error “Bug in Mailman version 2.1.11.cp3″

In latest cPanel 11.24.5if you are receiving following while selecting “modify” option from your cPanel >> Mailing Lists it will open mailing list with the following error message…

Mailing list bug

You can resolve above error by using following command form your shell but make sure that you are logged in as a root user.

root@gunjan[]#chmod 02775 -R /usr/local/cpanel/3rdparty/mailman/

and if its also not resolving your issue then you can read more on it here….

How to check process id for services?

You can check the process id for specific service by using following command from your command prompt.

root@gunjan[]#pidof service_name

For example we need to check process id for mysql service

root@gunjan[]#pidof mysql

16140

Category: Basic Linux  Tags: , , ,  Comments off