PPP module in a VPS/Container

December 8, 2009    |   Posted by admin   |    Category: VPS Management

How to enable PPP feature in a VPS/Container OR steps if PPP module not working on a VPS?

In order to enable PPP feature for a VPS/Container, the Hardware node should have the

ppp_async
ppp_deflate

modules loaded in the kernel. To load the modules on the hardware node, execute

# modprobe ppp_async
# modprobe ppp_deflate

lsmod will list the modules those are active.

# lsmod | grep ppp
ppp_deflate            39168  0
zlib_deflate           52760  1 ppp_deflate
ppp_async              45184  0
crc_ccitt               6337  1 ppp_async
ppp_generic            20165  6 ppp_deflate,ppp_async
slhc                   30561  1 ppp_generic

You now need to enable PPP feature for the VPS:

# vzctl set VEID --features ppp:on --save

Now, set ppp within the VPS:

# vzctl set VEID --devices c:108:0:rw --save
# vzctl exec VEID mknod /dev/ppp c 108 0
# vzctl exec VEID chmod 600 /dev/ppp

Now, restart the VPS

# vzctl restart VEID

Login to the VPS:

# vzctl enter VEID

See if the PPP module works in the VPS:

# /usr/sbin/pppd

You should now receive a message asking for the password or some garbage characters. If you see something else, then something is wrong.

How to create archives and compressed files?

December 6, 2009    |   Posted by admin   |    Category: Linux Administration

How to create a .tar, .tar.gz and .tar.bz2 file?

# tar -cf example.tar example
# tar -zcf example.tar.gz example
# tar -jcf example.tar.bz2 example

root@server [~]# ll
drwxr-xr-x  2 root     root      4096 Dec  6 07:02 example/
-rw-r–r–  1 root     root     30720 Dec  6 08:11 example.tar
-rw-r–r–  1 root     root       912 Dec  6 08:11 example.tar.bz2
-rw-r–r–  1 root     root       659 Dec  6 08:11 example.tar.gz

How to extract a .tar, .tar.gz and .tar.bz2 file?

# tar -xf example.tar
# tar -zxf example.tar.gz
# tar -jxf example.tar.bz2

If you use ‘v’ switch in the above examples, it will display detail message during the command execution.

How to compress a file using zip, gzip and bzip2?

# zip file.zip file
# gzip file
# bzip2 file

root@server [~]# ll
-rw-r–r–  1 root     root       14 Dec  6 08:16 file.bz2
-rw-r–r–  1 root     root       25 Dec  6 08:15 file.gz
-rw-r–r–  1 root     root      140 Dec  6 08:15 file.zip

How to extract zip, gzip and bzip2 compressed files?

# unzip file.zip
# gunzip file.gz
# bzip2 -d file.bz2

With gunzip and bzip2, the files will be extracted but you will no longer have the compressed file.

Comments Off on How to create archives and compressed files?

howto: turn off open_basedir in Plesk

December 3, 2009    |   Posted by admin   |    Category: Plesk Management

How to turn off open_basedir in Plesk?

By default Plesk applies open_basedir restriction for all the domains on the server. You can remove the open_basedir restriction lines from the httpd.include file located at /home/httpd/vhosts/example.com/conf/ directory but Plesk will overwrite the file again once it rebuild the include files.

To permanently remove the open_basedir restrictions for a domain, create a vhost.conf file

vi /home/httpd/vhosts/example.com/conf/vhost.conf

and place the following lines:

<Directory /home/httpd/vhosts/example.com/httpdocs/>
php_admin_value open_basedir none
</Directory>

Once done, rebuild the include file with the command:

/usr/local/psa/admin/bin/websrvmng -a

and restart the Apache service:

service httpd restart

To verify the new settings, place a phpinfo.php file under the account, browse the file and check the “Local Value” column.

Comments Off on howto: turn off open_basedir in Plesk

Howto: Change cPanel theme for multiple accounts.

December 3, 2009    |   Posted by admin   |    Category: cPanel Management

How to change cPanel theme for multiple accounts?

The cPanel theme for an account is specified in the /var/cpanel/users/username file in the format

RS=value

For example:

BWLIMIT=unlimited
DEMO=0
DNS=domainname.com
FEATURELIST=default
HASCGI=1
IP=IPHERE
LANG=english
LOCALE=en
MAXADDON=0
MAXFTP=0
MAXLST=0
MAXPARK=0
MAXPOP=5
MAXSQL=0
MAXSUB=0
MTIME=1271068514
OWNER=root
PLAN=default
STARTDATE=1228721668
USER=username
RS=x3

where, x3 is the theme. WHM only provides the option to change the cPanel theme for an account one at a time. In order to change the theme for all the accounts at once, execute the following script:

for i in `ls -la /var/cpanel/users/ | awk ‘{print $9}’ | sed ‘1,3 d’`
do
sed -i “/RS/d” $i;
echo “RS=x3″ >> $i;
done;

here, it will change the cPanel theme of all the accounts on the server to ‘x3’ theme.  Since all the files are updated manually, you need to execute the following script to rebuild the cache

/scripts/updateuserdomains

Note: The single OR double quotes in the script may change to dot (.) on copy/pasting the command in the shell, so make sure you correct those before executing the command.

Howto: disable Mod Security for an account

December 1, 2009    |   Posted by admin   |    Category: Linux Administration

How to Turn off Mod Security OR How to disable Mod Security for an account?

Mod_Security for an account is turned off/disabled on depending upon the version of Mod_Security i.e. it can be disabled in .htaccess file in modsecurity1 and have to disable it in VirtualHost entry of a domain in modsecurity2. Apache 1.x supports Mod Security1 and Apache 2.x supports Mod Securiry2. To find out the version of Apache, execute

httpd -v

Mod Security1:

Create a .htaccess file in an account

vi .htaccess

and insert the following:

<IfModule mod_security.c>
SecFilterEngine Off
SecFilterScanPOST Off
</IfModule>

Mod Security2:

You cannot disable mod security in a .htaccess file here (it’s setup this way to enhance security). You have to turn off mod security in the VirtualHost of the domain in the Apache configuration file. Edit the configuration file:

vi /etc/httpd/conf/httpd.conf

scroll down to the VirtualHost of the domain and place the following lines:

<IfModule mod_security2.c>
SecRuleEngine Off
</IfModule>

Save the configuration file and restart the Apache service.

service httpd restart

Comments Off on Howto: disable Mod Security for an account