HowTo: Manage Sudo users commands and previleges

Posted on

If you want to prevent users from executing a specific command have a look at this.

ssh ALL=(user1) ALL, !/usr/bin/passwd 

Add users and use specific commands

#includedir /etc/sudoers.d

User_Alias JAVATEAM = fileupuser
Cmnd_Alias JUSERCMD =/etc/init.d/tomcat,/usr/bin/tail
User_Alias ADMINTEAM = innouser
Cmnd_Alias SYSTEM =/sbin/service,/usr/sbin/ss,/bin/df,/usr/bin/du,/usr/bin/top,/bin/netstat,/usr/sbin/lsof,/bin/ps,/sbin/chkconfig
Cmnd_Alias FILEM =/bin/zcat,/usr/bin/tail,/bin/cat,/bin/grep
Cmnd_Alias COMPRESS =/usr/bin/unzip,/usr/bin/bzip2,/usr/bin/zip,/bin/tar

this could be understand the logic easily.

Howto: Android_device_enable_rooting

Posted on Updated on

Download packages:

Kingo-compactable devices :

Kingo-ROOT download :

Step one: Download and install Kingo Android Root into the PC.


Step two: Enable USB debugging mode on your phone. If it’s running Android 4.0 or 4.1, tap Settings, Developer Options, then tick the box for “USB debugging.” (You may need to switch “Developer options” to On before you can do so.) On Android 4.2, tap Settings, About Phone, Developer Options, and then tick USB debugging.” Then tap OK to approve the setting change.
On Android 4.3 and later (and some versions of 4.2), tap Settings, About Phone, then scroll down to Build Number. Tap it seven times, at which point you should see the message, “You are now a developer!”

Step three: Run Android Root on your PC, then connect your phone via its USB cable. Make sure Device compactable USB driver installed,


Step four: Click Root and wait for couple of minutes to complete, including the automated reboot at the end.

Howto: Install OpenCV + Apache + Mysql + WSGI with ffmpeg and QT support on Ubuntu 14.04

Posted on Updated on

Install java version “1.7.0_65” and Python 2.7.6 (default, Mar 22 2014, 22:59:56), follow any method
##Update the current installed packages

 sudo apt-get update && sudo apt-get -y upgrade

## To install OpenCV 2.4.2 or 2.4.3 on the Ubuntu 12.04 operating system, first install a developer environment to build OpenCV.

 sudo apt-get install build-essential cmake pkg-config
 sudo apt-get install curl qt-sdk unzip yasm checkinstall build-dep

##Install Image I/O libraries

 sudo apt-get install libjpeg62-dev libtiff4-dev libjasper-dev

##Install the GTK dev library

 sudo apt-get install libgtk2.0-dev

##Install Video I/O libraries

 sudo apt-get install libavcodec-dev libavformat-dev libswscale-dev libv4l-dev

##Optional – install support for Firewire video cameras

 sudo apt-get install libdc1394-22-dev

##Install video streaming libraries

 sudo apt-get install libxine-dev libgstreamer0.10-dev libgstreamer-plugins-base0.10-dev

##Install the Python development environment and the Python Numerical library

 sudo apt-get install python-dev python-numpy python-pip
 sudo apt-get install python-opencv python-software-properties python-mysqldb python-xml

##Install the parallel code processing library (the Intel tbb library)

 sudo apt-get install libtbb-dev

##Install the Qt dev library

 sudo apt-get install libqt4-dev

##Install OpenCV Additional support Video/Audio and SSL libraries

 sudo apt-get install zlib1g-dev libssl-dev libreadline-dev libyaml-dev libxml2-dev libxslt1-dev libcurl4-openssl-dev libopencv-dev libmp3lame-dev libopencore-amrnb-dev libtheora-dev libvorbis-dev libxvidcore-dev x264 v4l-utils

##Install Apache Server and dependencies

 sudo apt-get install libapache2-mod-wsgi apache2 apache2.2-common apache2-mpm-prefork apache2-utils libexpat1 ssl-cert

##Install Mysql Database Server

 sudo apt-get install mysql-server libmysqlclient-dev

##Installing Python Modules

pip install numpy
pip install pyopencv
pip install Django==1.7.3
pip install django-admin-tools==0.5.2
pip install django-debug-toolbar==1.2.2
pip install django-extensions==1.4.9
pip install ipython==2.3.1
pip install six==1.9.0
pip install sqlparse==0.1.13
pip install wsgiref==0.1.2
pip install MySQL-python==1.2.5

##Download and Extraction OpenCV package

curl "${OPENCV_VER}.zip" -o opencv-${OPENCV_VER}.zip
unzip "opencv-${OPENCV_VER}.zip" && cd "opencv-${OPENCV_VER}"
mkdir build && cd build

##Building OpenCV package from source


##Installing OpenCV Package

make -g2 && make install

## Providing Dummy Firewire Video camera device

sudo ln /dev/null /dev/raw1394

##Including Additional Library path

echo "/usr/local/lib" >> /etc/
sudo ldconfig

##SettingUp environmetn variables

echo "PKG_CONFIG_PATH=$PKG_CONFIG_PATH:/usr/local/lib/pkgconfig

## Execution environment variables for the currnet shell

source /etc/profile.d/


python -c "import cv2; print(cv2.__version__)"
pkg-config --modversion opencv

#Add Vhost for Apache

root@ip-10-184-30-74:~# pip --version #will show the dist-packages path
pip 1.5.4 from /usr/lib/python2.7/dist-packages (python 2.7)
vi /etc/apache2/sites-available/

<VirtualHost *:80>
 DocumentRoot /opt/web-home/raspberrypi/facecount
 WSGIDaemonProcess rasberry-pi_demo user=anand group=www-data maximum-requests=10000 python-path=/opt/web-home/raspberrypi/facecount:/usr/lib/python2.7/dist-packages
 WSGIScriptAlias / /opt/web-home/raspberrypi/facecount/
WSGIScriptReloading On
WSGIPassAuthorization On
<Directory /opt/web-home/raspberrypi/facecount/>
 Require all granted
 <Location />
 WSGIProcessGroup rasberry-pi_demo
Alias /static /opt/web-home/raspberrypi/facecount/static-assets/
<Directory /opt/web-home/raspberrypi/facecount/static-assets/>
 Require all granted
ErrorLog /opt/web-home/raspberrypi/apache_logs/error.log
 # Possible values include: debug, info, notice, warn, error, crit,
 # alert, emerg.
 LogLevel warn
 CustomLog /opt/web-home/raspberrypi/apache_logs/access.log combined

Now Restart Apache

service apache restart

Error: ctypes error: libdc1394 error: Failed to initialize libdc1394

Posted on Updated on

Error while importing Open CV in python with django framework , While compiling the application , it thrown the error like below. libdc1394 is a library for controlling camera hardware. It is an optional installation for the OpenCV package which unable to load the hardware for this time

Error :

libdc1394 error: Failed to initialize libdc1394

We don’t need to use camera hardware, is there perhaps a way of compiling without that part of OpenCV or If the server is in VBox/Virtualization system simply enable USB controller.
If it is remote server and we don’t need camera hardware you can create the null link for the IO dev.

 sudo ln /dev/null /dev/raw1394

Error: Fatal Python error: PyEval_AcquireThread: NULL new thread state

Posted on

This might be cause of various issue.

1, mod_wsgi is compiled for a different Python version and/or a different Python installation than the Python virtual environment

2, Python installation it is trying to use at runtime

3, If mod_wsgi and mod_python are both enabled.

In my case, I figured out the third cause. for fixing disabled mod_python because I was running website under wsgi wrapper.

sudo a2dismod python
sudo service apache2 restart


Error: Authz_core:error Client Denied by Server Configuration

Posted on Updated on

I have upgraded apache2.2 to 2.3, now a strange error I faced. Existing Apache authorization directives are not working,

I have done a modification that fixed the issue

Error :

[Wed Jan 28 04:29:51.468839 2015] [authz_core:error] [pid 29764:tid 139708675897088] [client] AH01630: client denied by server configuration: /opt/web-home/raspberrypi/facecount/static-assets/images/detect.png

This changes the way that access control is declared from

  Order allow, deny
  Allow from all

to :

  Require all granted

his means that the total configuration for a Directory is now something like:

  <Directory /path/to/directory>
    Options FollowSymlinks
    AllowOverride none
    Require all granted

Restart apache and it’ll all work nicely.

HowTo: Setup javameloy for watching J2EE application server activities

Posted on Updated on

Javamelody is a tool to monitor J2EE application servers, I has capability for showing real-time statistics,  I have integrated this tool with nearly 40 servers which connected with Javamelody collector server . It is the good choice for debugging and fine tunning J2EE applications by statistics history. Once you connected the java melody to an collector server it role it to collect all the data from the connected server for every 1 min. it will be avoid storing GBs of statistics data in the application server.

For more details Please check this

I followed the given steps for deploying in Tomcat containers,



1, Copy the jars to the lib dir of the applications

cp -rpf javamelody-1.49.0.jar iText-2.1.7.jar jrobin- <webapps>/ROOT/WEB-INF/lib

2, Modify  web.xml

cp -rpf web.xml web.xml_$(date +%F)
vi <webapps>/ROOT/WEB-INF/web.xml
 <!--====================== Monitoring ===================================-->
 <!-- Custom CSS -->
 <!-- Monitor filter -->
 <web-resource-name> monitoring URL </web-resource-name>
 <url-pattern> /monitoring/* </url-pattern>
 <http-method> GET </http-method>
 <http-method> POST </http-method>
 <!-- the same like in your tomcat-users.conf file -->
 <role-name> watcher </role-name>
 <auth-method> BASIC </auth-method>
 <realm-name> Password please !!! </realm-name>
 <description> </description>
 <role-name> watcher </role-name>

2, Modify security.xml if needed

cp -rpf security.xml security.xml_$(date +%F)
vi  <webapps>/ROOT/WEB-INF/security.xml
<sec:http pattern="/monitoring/**" security="none"></sec:http>

3, Add the credential for basic auth

cp -rpf tomcat-users.xml tomcat-users.xml_$(date +%F)
vi $CATALIAN_HOME/conf/tomcat-users.xml
<user username="user" password="password" roles=watcher"/>

Now restart the tomcat.


This is only for those who deployed more than one Javamelody.

JavaMelody collector server installation:

Download and Deploy the collector application in the webserver

From the browser you can see the application like below

Monitoring JavaMelody on Beijing stg2 web3 BeijingInternal


Name of application to monitor : Just a name to identify the application it can be any thing

eg : mywebserver1 , mywebserver2

URL(s): Valid monitoring URL without “/monitoring”, provide basic authentication if enabled.

eg : http://<username&gt;:<password>

It can be add many javamelody instances like below: