Archive for » November, 2009 «

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

Redirect code from http to https by using .htaccess?

Your can redirect all http (Non-secure) URL to https by using following code in .htaccess file.

RewriteEngine on
Options +FollowSymLinks
RewriteCond %{SERVER_PORT} !^443$
RewriteRule ^.*$ https://%{SERVER_NAME}%{REQUEST_URI} [L,R]

Redirect code from https to http?

Your can redirect all https (Secure) URL to http by using following code in .htaccess file.

RewriteEngine on
Options +FollowSymLinks
RewriteCond %{SERVER_PORT} !^80$
RewriteRule ^.*$ http://%{SERVER_NAME}%{REQUEST_URI} [L,R]

Category: .htaccess  Comments off

Disable directory listing for folders by using .htaccess?

To disable the Directory listing for folders you need to create the .htaccess file under the each an every folder under which you want to disable the Directory listing and insert the following code in .htaccess file.

————
Options -Indexes
————-

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 repair mysql database table manually?

You can repair the database table manually from shell by using following command.

root@gunjan[~]mysql>mysql –u databaseusername –p databasename

For example if we are using database gunjan_db

root@gunjan[~]mysql

mysql> use gunjan_db;
Database changed

mysql> show tables;

+———————————————+
| Tables_in_gunjan_db              |
+———————————————+
| additional_images
| address_book
| address_format
| administrators
| banners
| banners_history
| cache
| categories
| categories_description
| configuration
| configuration_group

| counter

| orders_products
| orders_products_attributes
| orders_products_download
| c
| orders_status_history
| orders_total

For example we need to repair table orders_status

mysql> repair table orders_status;
+————————————+——–+———-+———-+
| Table                              | Op     | Msg_type | Msg_text |
+————————————+——–+———-+———-+
| gunjan_db.orders_status | repair | status   | OK       |
+————————————+——–+———-+———-+
1 row in set (0.11 sec)

mysql> q
Bye

How to disable local-mail delivery for one domain name?

You can disable local-mail delivery for one  domain name from your shell and follow the instructions..

First go to file
root@gunjan[~]#vi /etc/localdomains
Then select the domain name give them comment# or remove it and save the file
:wq!

Second step go to file
root@gunjan[~]#vi /etc/remotedomains
and add the domain name we have comment or removed in the above file
:wq!

Basically when ever we use external mail server at that time we need to remove domains entry from /etc/localdomains file and add it in /etc/remotedomains file

Enable html display for horde?

You can enable the html display for horde by using following steps but please make sure that you have been logged in as root.

root@gunjan[~]# vi /usr/local/cpanel/base/horde/imp/config/mime_drivers.php

Search for the line
—-
/**
* HTML driver settings
*/
$mime_drivers['imp']['html']['inline'] = false;

—–

and replace it with

——–
/**
* HTML driver settings
*/
$mime_drivers['imp']['html']['inline'] = true;

——–
Save the changes and restart the following services.
root@gunjan[~]#service cpanel restart
root@gunjan[~]#/scripts/restartsrv_courier

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