Cenos

Info: NFS Server&Client Setup

Posted on Updated on

Server Side

NFS share with read/write privilege for the specified UID and GID, So even root will denied to write or read in that particular mount point and completly secure from everything.

Install required packages of  NFS server.

apt-get install nfs-kernel-server nfs-common portmap

After the installation of NFS server edit /etc/exports fileand add a line as follows.

/mnt/nfs      192.168.0.0/24(rw,sync,anonuid=106,anongid=114,no_subtree_check)
     ↓           ↓                            ↓
NFSsharepath | network | Options(Here we need to set user id and group id of tomcat user)

Restart nfs server after making necessary changes in  the exports file.

#service nfs-kernel restart

Client side Linux

Install nfs client packages on NFS client machine. Mount nfs share in the client machine.

apt-get install portmap nfs-common

Make the following entry in /etc/fstab/

192.168.1.175:/mnt/nfs /home/nfs   nfs rsize=8192,wsize=8192,timeo=14,intr
           ↓                        ↓         ↓
Network share details          Mount point   Filesystem

Client Side Windows

Install nfs services for windows through control panel add or remove windows component wizard.

Edit Windows registery and make changes as follows  in the registery.

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\ClientForNFS \CurrentVersion\Default

1, Create two DWORD values namely AnonymousUid and AnonymousGid
2, Set these values to the UID and GID as set in the  NFS server for tomcat user (Eg:-106,114)
3, Restart NFS service.

Go to all programs- Administrative tools- Services for network filesystem and Start service of ClientForNFS.
Select properties of clientfornfs and set permissions as per the requirement. (Eg:- Read&write permission for the

Error: SecurityException in Application.cpp:188: Do not have root privileges. Executable not set-uid root?

Posted on Updated on

After recovering my Cpanel server it was getting the Internal server error for every domain hosted and throwing  some messages in error log

[Wed Jul 17 09:46:14 2013] [error] [client 111.222.333.444] Premature end of script headers: index.php, referer: http://domain.com/
[Wed Jul 17 09:46:14 2013] [error] [client 111.222.333.444] SecurityException in Application.cpp:188: Do not have root privileges. Executable not set-uid root?

My server is configured for running suphp in CGI mode with Mod-security, So it will check the sticky bit of the suphp binary.The error was because the suphp binary was missing its suid permissions and assigning it fixed the issue.

chmod +s /opt/suphp/sbin/suphp

This should fix the issue instantly.

 

 

Howto : Install yum after installing OS on centos

Posted on

Yum  is a awesome tool written in python used to install packages in redhat flavours. It have ability to choose dependency packages as it own from the repository needed by the installing packages. If you missed to find yum in your server, follow the below steps to install

you can get the packages from here ftp://rpmfind.net/linux/centos/6.4/os/x86_64/Packages/ 

Use wget to download these pacakages.

Package list:

gpgme-1.1.8-3.el6.x86_64.rpm
pygpgme-0.1-18.20090824bzr68.el6.x86_64.rpm
python-iniparse-0.3.1-2.1.el6.noarch.rpm
python-pycurl-7.19.0-8.el6.x86_64.rpm
python-urlgrabber-3.9.1-8.el6.noarch.rpm
rpm-4.8.0-32.el6.x86_64.rpm
rpm-python-4.8.0-32.el6.x86_64.rpm
yum-3.2.29-40.el6.centos.noarch.rpm
yum-metadata-parser-1.1.2-16.el6.x86_64.rpm
yum-plugin-fastestmirror-1.1.30-14.el6.noarch.rpm

upgragde rpm to latest version to avoid package confilct error follow the below switchs

 [root@anand ~]# cd /root/installer/
[root@anand installer]# rpm -ivh --replacefiles rpm-4.8.0-32.el6.x86_64.rpm
 warning: rpm-4.8.0-32.el6.x86_64.rpm: Header V3 RSA/SHA1 Signature, key ID c105b9de: NOKEY
 Preparing... ########################################### [100%]
        1:rpm ########################################### [100%]
[root@anand installer]# mv rpm-4.8.0-32.el6.x86_64.rpm ../.
[root@anand installer]# rpm -ivh *
 warning: gpgme-1.1.8-3.el6.x86_64.rpm: Header V3 RSA/SHA256 Signature, key ID c105b9de: NOKEY
 Preparing...                         ########################################### [100%]
 1:yum-metadata-parser                ########################################### [ 11%]
 2:rpm-python                         ########################################### [ 22%]
 3:python-pycurl                      ########################################### [ 33%]
 4:python-urlgrabber                  ########################################### [ 44%]
 5:python-iniparse                    ########################################### [ 56%]
 6:gpgme                              ########################################### [ 67%]
 7:pygpgme                            ########################################### [ 78%]
 8:yum-plugin-fastestmirro            ########################################### [ 89%]
 9:yum                                ########################################### [100%]

Now you can create a package repository as your own. floks 🙂

ERROR: SQL error: [unixODBC][Driver Manager]Data source name not found, and no default driver specified

Posted on Updated on

One of our server getting odbc_connection error after migration, this will usually  happens because ODBC module has not enabled on the server,  While I tried to set up ODBC with freeTDS in order to connect to a MSSQL server faced several issues.

MSSQL uses Tabular Data Stream (TDS) as a communication protocol which is same like in Sybase. freeTDS is an implementation of TDS protocol.

Before trying to connect with freetds to the mssql server, make sure, that your MSSQL server has remote access to connect.

[02-May-2013 02:21:31 America/Denver] PHP Warning: odbc_connect() [<a href='function.odbc-connect'>function.odbc-connect</a>]: SQL error: [unixODBC][Driver Manager]Data source name not found, and no default driver specified, SQL state IM002 in SQLConnect in /home/anand/public_html/mssql2000.php on line 69

We need below packages installed to get this done.

1, php-odbc
2, unixODBC
3, freetds

Installation : 

#pecl  install php-odbc
#yum install unixODBC-devel unixODBC freetds-devel freetds

Or,

Download unixODBC and untar it

#wget ftp://ftp.unixodbc.org/pub/unixODBC/unixODBC-2.3.0.tar.gz
#tar –xzf unixODBC-2.3.0.tar.gz
#cd unixODBC-2.3.0 ; ./configure ; make ; make install

Installing freeTDS
Set environmental variable at /etc/profile. Add following lines at end

#vi /etc/profile
 # TDS
SYBASE=/usr/local 
LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:$SYBASE/lib 
export SYBASE LD_LIBRARY_PATH 
#http://ibiblio.org/pub/Linux/ALPHA/freetds/stable/freetds-stable.tgz
#tar –xzf freetds*.tar.gz ; cd freetds* ; ./configure --with-tdsver=8.0 --with-unixodbc=/usr/local ; make ; make install

Configuration:
Note: tdsver=8.0 if you use SQL 2000, tdsver=7.0 if you use SQL 7.0, More info about freetds.conf here

root@server [~]# cat /etc/freetds.conf
[MSSQLSERVER]               
host = 11.222.333.44
port = 1433
tds version = 8.0

Setup ODBC:
Create template for both driver and configuration. before creating make sure that the driver files are valid.

root@server [~]# vi tds.driver.template
#Driver for MS SQL
[FreeTDS]                       #"FreeTDS" is the unique name for this driver
Description = FreeTDS driver
Driver = /usr/lib64/libtdsodbc.so.0
Setup = /usr/lib64/libtdsS.so.1
FileUsage = 1
UsageCount =1

root@server [~]# vi tds.datasource.template
[MSSQL]               #"MSSQL" is the DSN name that we call to connect database
Driver = FreeTDS      # name that we specified in the driver file
Description = MSSQL ReflectiveLearning
Trace = No
TraceFile = /var/log/freetds.log
Servername = MSSQLSERVER    # this  name specified in the freetds.conf
Port = 1433
Database = reflective_Live
TDS_Version = 8.0
 Now install the data source and driver

The below commands will create configuration file for odbc but odbc.ini has create in users home dir by default we have to move it manually to /etc/

odbcinst -i -d -f tds.driver.template
odbcinst -i -s -f tds.datasource.template
cp -rpf ~/.odbc.ini /etc/odbc.ini
mv /etc/odbc.ini /usr/local/etc
mv /etc/odbcinst.ini /usr/local/etc
cd /etc
ln -s /usr/local/etc/odbc.ini
ln -s /usr/local/etc/odbcinst.ini
chmod 0664 /usr/local/etc/odbc*.ini
cd ~

check by using command line
#tsql -H Hostname_OR_IP -p PortNumber -U Username

root@server [~]# isql -v DSNname Username 'Password'
+---------------------------------------+
| Connected!                            |
|                                       |
| sql-statement                         |
| help [tablename]                      |
| quit                                  |
|                                       |
+---------------------------------------+
SQL> quit
That’s all, now the application will works fine.
some PHP code to connect to it
<?php
//*************************************************************************
//Open Database Connection
//************************************************************************* 
$dbserver="ipaddress";
$dbusername="tester4";
$dbpassword="password1234";
$defaultdb="testdb";
$cn = mssql_connect($dbserver,$dbusername,$dbpassword) or die("Connection Error");
$db = mssql_select_db($defaultdb,$cn) or die("Database Error");
echo "Connection Success"
?>

Some of the useful commands,

odbcinst -j         # to check the ODBC version and configuration.
odbcinst -q -d   # View loaded drivers.
odbcinst -q -s   # View DSN entry
tsql -LH 22.33.55.44   #To list MSSQL server instant name,version etc.,
osql -S DSN -U Username -P ‘Password’ #list the configuration files loaded to connect ODBC

Info: Cpanel BootCamp & Cheetsheet .

Posted on Updated on

Cpanel has provided cheetsheet for the users, this may help you to know about how cpanel compatable for linux-distro.  Detailed information on below documents.

BootCamp :   

Cheetsheet :  

Source:http://www.thecpaneladmin.com