Sunday, 8 July 2012

Install ASL-Lite in Linux servers

ASL Lite is a free unsupported lightweight rule updater and basic modsecurity setup project designed specifically as an atomicorp.com mod_security rule downloader for custom apache environments or non-apache/mixed web server implementations. It will on a standard system maintain modsecurity rules to the current version automatically, and upon installation will attempt to determine if modsecurity is installed on the system, and if so, what version if installed. If modsecurity is not installed, it will attempt to install it, and if the installed version is out of date it will attempt to upgrade it to the latest stable version.
For more info: http://www.atomicorp.com/wiki/index.php/ASL_Lite

1. wget -q -O – http://www.atomicorp.com/installers/asl-lite | sh

2. Compare the dates to make sure the security module is the latest.

date

ls -l /usr/local/apache/modules/mod_security2.so

3. Make all the required folders and put them in the right permission

mkdir -v /usr/local/apache/conf/modsec_rules/
cp -pv
/home/cpeasyapache/src/modsecurity-apache_2.5.13/rules/util/modsec-clamscan.pl
/usr/local/apache/conf/modsec_rules/modsec-clamscan.pl
chmod -v /var/asl
chmod -v 705 /var/asl/data
chown nobody.nobody /var/asl/data/msa
chown nobody.nobody /var/asl/data/audit
chown nobody.nobody /var/asl/data/suspicious
chmod o-rx -R /var/asl/data/

chmod ug+rwx -R /var/asl/data/



4. Verify if mod_security is being called correctly.

# cat /usr/local/apache/conf/modsec2.user.conf
=========
SecRequestBodyAccess On
SecAuditLogType Concurrent
SecResponseBodyAccess On
SecResponseBodyMimeType (null) text/html text/plain text/xml
SecResponseBodyLimit 2621440
SecAuditLogRelevantStatus "^(?:5|4(?!04))"
SecServerSignature Apache
SecRule FILES_TMPNAMES "@inspectFile /usr/local/apache/conf/modsec_rules/modsec-clamscan.pl" "log,auditlog,deny,status:403,severity:2,phase:2,t:none,id:'1010101'"
SecUploadDir /var/asl/data/suspicious
SecUploadKeepFiles Off
SecAuditLogParts ABIFHZ
SecArgumentSeparator "&"
SecCookieFormat 0
SecRequestBodyInMemoryLimit 131072
SecDataDir /var/asl/data/msa
SecTmpDir /tmp
SecAuditLogStorageDir /var/asl/data/audit
SecResponseBodyLimitAction ProcessPartial
SecPcreMatchLimit 50000
SecPcreMatchLimitRecursion 50000
Include /usr/local/apache/conf/modsec_rules/10_asl_antimalware.conf
Include /usr/local/apache/conf/modsec_rules/10_asl_rules.conf
Include /usr/local/apache/conf/modsec_rules/20_asl_useragents.conf
Include /usr/local/apache/conf/modsec_rules/30_asl_antispam.conf
Include /usr/local/apache/conf/modsec_rules/50_asl_rootkits.conf
Include /usr/local/apache/conf/modsec_rules/60_asl_recons.conf
Include /usr/local/apache/conf/modsec_rules/99_asl_jitp.conf
Include /usr/local/apache/conf/modsec_rules/whitelist.conf
========= 

#cat  /usr/local/apache/conf/modsec2.conf
====
 LoadFile /opt/xml2/lib/libxml2.so
 LoadFile /opt/lua/lib/liblua.so
LoadModule security2_module  modules/mod_security2.so
<IfModule mod_security2.c>
SecRuleEngine On
# See http://www.modsecurity.org/documentation/ModSecurity-Migration-Matrix.pdf
#  "Add the rules that will do exactly the same as the directives"
# SecFilterCheckURLEncoding On
# SecFilterForceByteRange 0 255
SecAuditEngine RelevantOnly
SecAuditLog logs/modsec_audit.log
SecDebugLog logs/modsec_debug_log
SecDebugLogLevel 0
SecDefaultAction "phase:2,deny,log,status:406"
SecRule REMOTE_ADDR "^127.0.0.1$" nolog,allow
Include "/usr/local/apache/conf/modsec2.user.conf"
</IfModule>
 ====

 In httpd.conf file, make sure that, following entry is available. 
======
Include "/usr/local/apache/conf/modsec2.conf"
======

Configure ASL-Lite, update the rules, and put it in cron and Configure with username “username” and password “password”
======

asl-lite -c

Install the cron “0 5 /var/asl/bin/asl-lite -u”

asl-lite -u

======

Monitor logs for 30 mins to see if there are any errors

tail -f /usr/local/apache/logs/error_log

tail -f /usr/local/apache/logs/modsec_audit.log

Add ASL ClamAV rules and restart ClamD

Check what is the latest clamd signature by going to
www.atomicorp.com/channels/rules/subscription

Download the latest rule using
/usr/bin/wget—no-cache -q -P /usr/local/src/

Replace clamav-201107071712.tar.gz with whatever the latest rule is

Untar the file, change ownership and place it in ClamAV rules folder


cd /usr/local/src/
tar xzvf clamav-201107071712.tar.gz
cd /usr/local/src/clamav
mv -v ASL /usr/share/clamav
cd /usr/share/clamav
chown -v clamav.clamav ASL*

and ASL lite installation is completed successfully!

Saturday, 30 June 2012

RVsitebuilder Installation in cPanel

How to install RVsitebuilder in cPanel?

 1. SSH to your cPanel server as root and run command 

/scripts/makecpphp

2. Download the installer using the command below: 

cd /usr/local/cpanel/whostmgr/docroot/cgi/ 
rm -rf /usr/local/cpanel/whostmgr/docroot/cgi/rvsitebuilderinstaller/ 
rm -f rvsitebuilderinstaller.tar
wget http://download.rvglobalsoft.com/rvsitebuilderinstaller.tar
tar -xvf rvsitebuilderinstaller.tar
chmod 755 addon_rvsitebuilder.cgi 
rm -f rvsitebuilderinstaller.tar

3. Open root WHM, at the left menu under Plugins section, you will find RVSiteBuilder Installer menu.

4. Click RVSiteBuilder Installer to begin the installation process.

5. After complete the installation, you will be sent to RVSiteBuilder Manager automatically. Please configure RV SiteBuilder immediatly.

Done!! Your cPanel should show the RVSiteBuilder as a feature in all cPanel users. Special note for specific cPanel skin:


  • RVSkin - It will automatically integrate RVSiteBuilder to RVSkin. You may need to edit the Package-Feature list if RVSite Builder doesn't show up, or you don't want some hosting packages access to it.



  • X3, X Skin and some which support addon api - It will automatically display on cPanel. You are also able to manage the feature list in WHM Feature Manager.



  • CPSkins - You have to manually integrate it by editting file /usr/local/cpanel/base/frontend/themename/index.html. Insert on the top of the page, and edit /usr/local/cpanel/base/frontend/themename/main.php. Place in the area you want to show the RVSiteBuilder Icon. Don't edit file RVS2CPSkinmenu.html. Your change will be lost when you update RVSiteBuilder. If you want to edit it, just copy its name and change the cpanel include path to the new one.

Monday, 25 June 2012

Hardening the linux server or cenos 5/6.2

How to harden the centos 5 or centos 6.2



SPRI (Priority Scheduler)
cd /root/
wget http://www.rfxn.com/downloads/spri-current.tar.gz
tar xvfz spri-*.tar.gz
cd spri-*
./install.sh
spri -v



PRM (Process Resource Monitor)
cd /root
wget http://www.rfxn.com/downloads/prm-current.tar.gz
tar xvfz prm-*.tar.gz
cd prm-*
./install.sh
prm -j




Temporary Directory Hardening
-----------------------------

/bin/cp /etc/fstab /etc/fstab.bak


Use df to check if a /tmp partition is already present.

[if no /tmp partition present]
cd /usr
dd if=/dev/zero of=/usr/tmpMnt bs=1024 count=2000000


mke2fs -j /usr/tmpMnt


cd / 
cp -R /tmp /tmp_backup 


mount -o loop,noexec,nosuid,rw /usr/tmpMnt /tmp 
chmod 0777 /tmp 
/bin/cp -R /tmp_backup/* /tmp/ 
rm -rf /tmp_backup 


nano -w /etc/fstab 




At the very bottom add 
/usr/tmpMnt /tmp ext3 loop,noexec,nosuid,rw 0 0


nano -w /etc/fstab
change “defaults” to loop,noexec,nosuid,rw
mount /tmp


rm -rf /var/tmp
ln -s /tmp /var/tmp



If a symlink is not possible, then /var/tmp is most likely also a partition. In this case, /var/tmp must be hardened with loop,noexec,nosuid,rw in fstab as well.



IF /tmp is hardened by cpanel’s /scripts/securetmp. Remove the line from /etc/rc.d/rc.local and then reboot. It will come back without a /tmp partition and then you can follow the instructions above



SSH Server Hardening
---------------------

nano -w /etc/ssh/sshd_config



Uncomment #Protocol 2, 1
Change to Protocol 2


Append these lines to the bottom:
LoginGraceTime 120 


IgnoreRhosts yes 


X11Forwarding no 




/etc/rc.d/init.d/sshd restart


DISABLE DIRECT ROOT LOGIN


If he already has an su user, good. If not:


REPLACE XXX with 3 numbers


groupadd anyuserxxx
useradd anyuserXXX –ganyuserXXX
passwd anyuserXXX
type password


nano -w /etc/group
Search for wheel, then append “anyuserxxx” 


So it should be “root,anyuserXXX”


nano -w /etc/ssh/sshd_config


PermitRootLogin no (and uncomment)


At the bottom add
AllowUsers anyuserXXX




ChkRootKit
--------------
cd /root/
wget ftp://ftp.pangeia.com.br/pub/seg/pac/chkrootkit.tar.gz
mv chkrootkit.tar.gz /usr/local/src/
cd /usr/local/src/
tar -zxf chkrootkit.tar.gz
cd /usr/local/src/chkrootkit*
make sense
cd /root
mv /usr/local/src/chkrootkit* /usr/local/chkrootkit



cd /etc/cron.weekly

Code: Select all

#!/bin/bash


EMAIL=your@domain.com


/usr/local/chkrootkit/chkrootkit -q | mail -s "ChrootKit Scan Report - $(hostname)" $EMAIL


chmod 755 /etc/cron.weekly/chkrootkit.sh




RkHunter
------------

cd /root

wget http://space.dl.sourceforge.net/project/rkhunter/rkhunter/1.3.8/rkhunter-1.3.8.tar.gz

wget http://space.dl.sourceforge.net/project/rkhunter/rkhunter/1.3.8/rkhunter-1.3.8.tar.gz
tar -zxf rkhunter-1.3.4.tar.gz
cd rkhunter*
./installer.sh --layout default --install




cd /etc/cron.weekly

Code: Select all


#!/bin/bash

EMAIL=your@domain.com
rkhunter  -c --sk --summary -q |  mail -s "Rkhunter Scan Report - $(hostname)" $EMAIL


chmod 755 /etc/cron.weekly/rkhunter.sh




Installing CSF firewall
------

wget http://www.configserver.com/free/csf.tgz

tar -xzf csf.tgz

cd csf

sh install.sh



Next, test whether you have the required iptables modules:



perl /etc/csf/csftest.pl


Thursday, 21 June 2012

./wp-blog-header.php error [function.require]:failed to open stream


You have installed Wordpress and are seeing the following error:
Warning: require(./wp-blog-header.php) [function.require]: failed to open stream: No such file or directory in "\xyz\xyz.com\wwwroot\index.php" on line 17
Warning: require(./wp-blog-header.php) [function.require]: failed to open stream: No such file or directory in "\xyz\xyz.com\wwwroot\index.php" on line 17
This is most likely because you have installed wordpress into the wwwroot instead of a sub-directory.  Wordpress be default assumes it will be installed in a sub-directory.

To solve this problem, modify the index.php file as follows only if your WordPress installation is running in your root directory. You only need to change the following line:
require('./wp-blog-header.php');
To this:
require('wp-blog-header.php');
If your WordPress installation is not running in the root directory, then you just need to insert the path to your header file.  

Sunday, 17 June 2012

Install/upgrade curl in Litespeed webserver

How to install Curl in LiteSpeed webserver?

Kindly follow the steps below to know how to install curl in litespeed webserver.


1) Go to lsws directory


# cd /opt/lsws/phpbuild/php-5.2.6/

2) Check the compiled modules with litespeed and check the current status.

# cat config.nice
# cat config.status
#cat config.nice

3) Now you need to recompile the litespeed with the module

# ./configure --prefix=/opt/lsws/lsphp5 --with-litespeed --with-config-file-path=../php --with-mysql=../mysql --with-zlib --with-zlib-dir=.. --with-gd --with-jpeg-dir=.. --with-png-dir=.. --enable-shmop --enable-track-vars --enable-sockets --enable-sysvsem --enable-sysvshm --enable-magic-quotes --with-curl=/opt/curlssl/
# make
# make test
# make install

Once the installation is complete, you can check the compiled modules using the following command

# /opt/lsws/lsphp5/bin/php -m
# /opt/lsws/lsphp5/bin/php -i |grep curl 


Thats it Litespeed is compiled with CURL module. :) 

-= by Hemanth =-

Saturday, 16 June 2012

Remove a space in front of word or words in a file

How to remove space in front of a word in a file?



Just use this command to remove the space in front.

cat filename |cut -d":" -f2 |sort | sed -e 's/^[ \t]*//'

Now it will show you the output. If you want the output added inside a file just use this 

 cat filename |cut -d":" -f2 |sort | sed -e 's/^[ \t]*//' > filename.txt

Mailscanner : Allow extensions like .docx, .dox,

How to allow some other extensions like .docx, .app and etc in the mailscanner?

I have followed this post to allow the .zip extensions to  in the mailscanner.

http://linux-bloggers.blogspot.in/2012/06/mailscanner-allow-zip-tar-gz-extension.html


However, when I am trying to send email of my word doc and other files, that are being blocked by mailscanner. How to allow it?

Solution:-

You have two solutions to solve the issue.

Solution1:- Disable the SPAM scanner and virus scanner for that user alone via cPanel.
1) Go to cPanel > Emails > Mailscanner configuration.
2) Select the the domain name under SPAM and VIRUS option set it the options to "NO" and save the settings.

This will allow that domain to send emails with all the extensions.

Solution2:-


This is serverwide changes. Where the editing will reflect to all the domain in the server.

1) Login to the server with the root access
2) locate the file name "filename.rules.con"

in cPanel server it will be available in /etc/MailScanner/filename.rules.con

3) vi /etc/MailScanner/filename.rules.con
4) in that file, find the place which has specified "allow"
5) add the following syntax to allow the extension


allow \.docx$ - -
allow \.xlsx$ - -
allow \.app - -
allow \.x(ml)?\d{0,}\.rel$ - - 

Save the file and restart your mail scanner. Thats it. Your mailscanner will allow the specified extensions to all the domain in the server.

Note: When you add the syntax " allow \.docx$ - - ", you should use "TAB key" to leave a space between them. DO NOT use "spacebar" to leave the space. Beware!!!!! ;-)

Mailscanner: allow .zip .tar .gz extension in email

How can I configure MailScanner to allow zip/archive files through even if they contain an exe file or other potentially dangerous filename or filetype?

You can configure MailScanner to not check archives (zip, tar.gz etc).

 1) Go to WHM > MailScanner > MailScanner Configuration

and search for 'Maximum Archive Depth'.

2) Change that to 0 to disable it.

That's it. The mailscanner will allow the .zip, .tar and etc. The attachments will still be scanned for viruses.

Friday, 8 June 2012

Authentication erorr IIS home page

When you try to access the website, you will be getting an error message stating as follows:

=====
Authorization Error
=====

Its a known issue if you are running Plesk with IIS.

You can resolve the issue by performing the following.

===========
 

Anonymous access to the site was enabled in IIS:>IIS -> Web site -> domain.com -> Directory Security -> Enable anonymous access




Remove the .Security file from C:\Inetpub\vhosts\domain.com and reconfigure vhost via the following command: C:\Program Files\Parallels\Plesk\admin\bin>websrvmng --reconfigure-vhost --vhost-name=domain.com 

 
If the passwords for system user and IIS user seemed to be out of synchronization, change the password for IIS user on that domain and do the same in Computer Management -> Local Users and Settings -> Users -> IUSR_domain
Verify other domains are not having the same issue.

After performing the above, execute the following command from command prompt.
websrvmng --reconfigure-vhost --vhost-name=domainname.com


 Have a Great Surfing!!!!!

Sunday, 27 May 2012

PHP pages internal server error Plesk CGI/FCGI

When using PHP 5.3.3, php pages will be throwing internal server error when you select the PHP handler as CGI/FCGI.

You will be finding the following error message in the Apache logs.

======
 Premature end of script headers: cgi_wrapper
13)Permission denied: exec of '/usr/sbin/suexec' failed
======

To resolve the issue, change the ownership of the  '/usr/sbin/suexec' as follows:

====
root:apache
====

Previously, the ownership will be as follows:

====
root:root
====

The PHP pages will be loading fine...

Saturday, 26 May 2012

Detect top 10 spammers in exim

Detect top 10 spammers in exim

Eximstats is a useful command to find spamming in the cpanel server. Execute the following command in your terminal

/usr/sbin/eximstats -t10 /var/log/exim_mainlog > teststats

The stats output will be appended to a file called "teststats". This have the following data.

(t10 is an option which shows the top 5 count)
The above command gives the following details:

* Top 10 local destinations by volume
* Top 10 local destinations by message count
* Top 10 sending hosts by volume
* Top 10 sending hosts by message count

and other stats such as total number of mails received and
delivered...top 10 sender (username) and many other data are available in that file.

You just need to vi to that file or less the file.

vi teststats or less teststats

You will get all the information in the spammer account and email id.

How do I flush a computer DNS cache?

How do I flush a computer DNS cache?


To flush DNS cache in your computer or PC


Flush dns to get a new nameserver resolution for a domain. Flushing DNS cache might also helps you to check new redistered domain is accessable in the browser or not. You can simply flush your dns cache anytime to get new entry. 


Lets start Flushing the DNS cache



To flush DNS  cache in Windows (Win XP, Win ME, Win 2000, vista, windows7):-

- Start -> Run -> type cmd
- in command prompt, type ipconfig /flushdns
- Done! You Window DNS cache has just been flush.



To flush the DNS cache in Linux


- To restart the nscd daemon, type /etc/rc.d/init.d/nscd  or /etc/init.d/nscd restart in your terminal
- This will flush dns cache in linux machine




To flush the DNS cache in Mac OS
- type lookupd -flushcache in your terminal to flush the DNS resolver cache.
ex: bash-2.05a$ lookupd -flushcache
- Once you run the command your DNS cache (in Mac OS X) will flush.

To flush the DNS cache in Mac OS X Leopard
- type dscacheutil -flushcache in your terminal to flush the DNS resolver cache. 
ex: bash-2.05a$ dscacheutil -flushcache
- Once you run the command your DNS cache (in Mac OS X Leopard) will flush.


Server error. Upload directory isn't writable in wordpress

Server error. Upload directory isn't writable. in wordpress

When you have added a 3rd party plugin in the wordpress, there might be achange that you will get the above error.

The simple solution for this issue is changing the permission of uploads, special integrated theme upload and upgrade directory to 777

CSF error some missing iptables modules [4] ipt_REDIRECT...FAILED, ipt_owner, ipt_recent, iptables_nat

I have installed the CSF in the server. When I try to run the perl test in the CSF, it is giving the following error.

===============
# perl /etc/csf/csftest.pl
Testing ip_tables/iptable_filter...OK
Testing ipt_LOG...OK
Testing ipt_multiport/xt_multiport...OK
Testing ipt_REJECT...OK
Testing ipt_state/xt_state...OK
Testing ipt_limit/xt_limit...OK
Testing ipt_recent...FAILED [Error: iptables: Unknown error 4294967295] - Required for PORTFLOOD and PORTKNOCKING features
Testing xt_connlimit...FAILED [Error: iptables: Unknown error 4294967295] - Required for CONNLIMIT feature
Testing ipt_owner/xt_owner...FAILED [Error: iptables: Unknown error 4294967295] - Required for SMTP_BLOCK and UID/GID blocking features
Testing iptable_nat/ipt_REDIRECT...FAILED [Error: iptables: Unknown error 4294967295] - Required for MESSENGER feature
Testing iptable_nat/ipt_DNAT...OK

RESULT: csf will function on this server but some features will not work due to some missing iptables modules [4]
===============

Solution:


csf requires at least these iptables modules in the main node

ip_tables
ipt_state
ipt_multiport
iptable_filter
ipt_limit
ipt_LOG
ipt_REJECT
ipt_conntrack
ip_conntrack
ip_conntrack_ftp
iptable_mangle


Following modules are used for the other funcanality of csf

ipt_owner
ipt_recent
iptable_nat
ipt_REDIRECT


You can check if the above modules are installed in the server or not.

# lsmod |grep -i <module-name>

If it is not installed then you can install it via

modprob ipt_conntrack


You can test whether they have fixed the environment by running:

perl /etc/csf/csftest.pl

This will fix the issue.

In case of VPS like OpenVZ, Prallels Virtuozzo or etc, this might not been fixed some times. Just follow the steps below to fix the issue in the VPS container.

1. /sbin/iptables -F

2. Edit /etc/sysconfig/iptables-config

IPTABLES_MODULES="ipt_REJECT ipt_tos ipt_TOS ipt_LOG ip_conntrack ipt_limit ipt_multiport iptable_filter iptable_mangle ipt_TCPMSS ipt_tcpmss ipt_ttl ipt_length ipt_state iptable_nat ip_nat_ftp ip_conntrack_ftp ipt_conntrack ip_tables ip_conntrack_netbios_ns"


3.Edit /etc/sysconfig/vz

IPTABLES_MODULES="ipt_REJECT ipt_tos ipt_TOS ipt_LOG ip_conntrack ipt_limit ipt_multiport iptable_filter iptable_mangle ipt_TCPMSS ipt_tcpmss ipt_ttl ipt_length ipt_state iptable_nat ip_nat_ftp ip_conntrack_ftp ipt_conntrack ip_tables ip_conntrack_netbios_ns"


4. Execute the command in the console

service vz stop

service iptables restart

service vz start

Thursday, 17 May 2012

FAIL: ftp per_source_limit

At  times, you will find the following error message in the "/var/log/messages"

=======
FAIL: ftp per_source_limit from=xxx.xxx.xxx.xxx
=======

You can resolve the issue by adding the following line in the file '/etc/xinet.d/ftp_psa'

=======
per_source            = UNLIMITED 
=======

After saving the file, restart xinet.d by using the following command.

/sbin/service xinetd restart

 The issue will be resolved. :) 

Sunday, 6 May 2012

Disable Dr.Web email notifications


At times, you may get many emails notifying about the Dr.Web service.
You may disable it by following the steps mentioned below: It differs from one Plesk version to that of the other.
For Plesk 8:
Edit the file '/etc/drweb/drweb32.ini' and
set
UpdateNotify = no

For plesk 9:
Edit the file '/etc/drweb/drweb32.ini' and
set
CronSummary = no
Plesk 10 :
Edit the file:

/etc/cron.d/drweb-update

and at the end of the line add the following:

2>&1> /dev/null

It should look like this:

*/30 * * * * drweb /opt/drweb/update.pl 2>&1> /dev/null

 

 

Have a Nice Day :)

Saturday, 5 May 2012

Plesk Windows Statistics not being updated

If web statistics present in the Plesk panel is not working, you can run the following command in the command prompt.

==========
%plesk_bin%\statistics.exe" --all --process-domains=karthick.com --from-date=2012/5/2
==========

You can find more options by running statistics.exe --help

Have a Accurate Web Statistics :)

Friday, 4 May 2012

Wheel user to become as root (su -) without password

1. Create a user:

useradd test
passwd test

2. Add this user in wheel group.

usermod -a -G wheel test

3. Now, Edit PAM configuration file for su. (/etc/pam.d/su)

----
 vi /etc/pam.d/su

uncomment below line
auth sufficient /lib/security/$ISA/pam_wheel.so trust use_uid

This will allow users in wheel group as a trusted users.
-----

4. Login as test user.
 #su -
It will not ask for password.

OR

If we add the test user in "visudo", we need to use "sudo su -" to become root without password.
----
1. visudo or vi /etc/sudo
2.  Add the below line 
   test    ALL=(ALL)   NOPASSWD:ALL
3. Save and exit
----

It will also grant root privilege for the user "test", but we need to use "sudo su -" to became as a root.

Thursday, 3 May 2012

How to resolve : Internal server Error when accessing cPanel/WHM/Webmail



# inode checking :

Inode Usage : 

1) You can check the inodes of an account on your server by using SSH:

# quota -s <cPanel_username>

2) If you have SSH access to your account you can view the inodes for a specific folder using the following command :

root@XXX [/]# echo "Detailed Inode usage for: $(pwd)" ; for d in 'find -maxdepth 1 -type d | cut -d\/ -f2 | grep -xv . | sort' ; do c =$(find $d |wc -l) ; printf "$c\t\t- $d\n" ; done ; printf "Total: \t\t$(find $(pwd) | wc -l)\n"
                                                                          
Detailed Inode usage for: /                                                                      
98              - bin                                                                            
1               - boot                                                                            
110             - dev                                                                            
1237            - etc                                                                            
88873           - home                                                                            
201             - lib                                                                            
267             - lib64                                                                          
1               - media                                                                          
1               - mnt                                                                            
629             - opt                                                                            
13290           - proc                                                                            
205             - root                                                                            
182             - sbin                                                                            
1               - selinux                                                                        
1               - .spamassassin                                                                  
1               - srv                                                                            
304             - sys                                                                            
15              - tmp                                                                            
108013          - usr                                                                            
4273            - var                                                                            
Total:          217708
root@XXX [/]# 

Error : Unable to open pty: No such file or directory



unable to enter into VPS


You may get an error while entering to a openvz vps. You cant also ssh to the vps from outside.

Error:
vzctl enter xxxx
enter into VE xxxx failed
Unable to open pty: No such file or directory


1. If it is a redhat based system such as CentOS,

The solution is :
vzctl exec VEID /sbin/MAKEDEV pty
vzctl exec VEID /sbin/MAKEDEV tty
vzctl enter VEID

To fix this issue permanently

Edit the file /etc/rc.sysinit of the VPS
Comment the line :
/sbin/start_udev   to
#/sbin/start_udev

Add the following lines after /sbin/start_udev:
/sbin/MAKEDEV tty
/sbin/MAKEDEV pty


2. If it is a Debian system
vzctl exec veid update-rc.d -f udev remove
vzctl restart veid