UnixServerAdmin

Server Administration & Management

cPanel not showing FTP user accounts

This issue was due to the missing entries in the /etc/proftpd/username file.

For fixing this just issue the following command:-

# /scripts/ftpupdate.

This will sync the passwords of all the accounts in the server.

Advertisements

November 30, 2011 Posted by | cPanel, FTP | , | Leave a comment

What is Process Id 0 & Process Id 1

Process Id 0 :- All idle task has process ID zero and never exits.

Process ID 1 :- The init process having process ID 1, which is never be used but waiting around for its child processes to die. Usually started for /etc/inittab

November 29, 2011 Posted by | Tips & Tricks, Unix/Linux | , | Leave a comment

Unable to upload large files via ftp in Pro-FTP

1. Add the following lines to  lines to /etc/proftpd.conf

# vi  /etc/proftpd.conf

========================
AllowRetrieveRestart on
AllowOverwrite on
AllowStoreRestart on
========================

2. Restart ftp and this should fix the issue.

November 28, 2011 Posted by | FTP | | Leave a comment

How to Resolve FrontPage Problem

1. If anyone facing problems with the FrontPage installation then first uninstall the installed FrontPage from shell /home/<username>/public_html  and Then run the following commands one by one.

# rm -rf .htaccess.*

# rm -rf _vti_pvt/

# rm -rf _derived

# rm -rf _private

# rm -rf _vti_*

2. If server is SuExec enabled then first disable it from the WHM And install FrontPage for the specific domain where you have seems the problem and then try to publish site by using Frontpage. If you are still facing the problem then remove all the .htaccess.* from/home/<username>/public_html and remove all _* (private,vti,etc)one by one carefully.

3. Now try to install it and check for the permission and ownership of public_html folder

# chown -R username:username public_html

# chmod -R 755 public_html

4. If the problem still persists then check whether the permission of public_html/_vti_pvt/service.pwd is 600 or not? (try even setting an attr and set the permission to 600)

# chmod 600 service.pwd

# chattr +i service.pwd

# chattr -i service.pwd

It will sort out your problem enjoy !

November 27, 2011 Posted by | Apache, PHP | , , , | Leave a comment

How to Secure FTP by changing FTP Port number in Pure-FTP

In recent few months FTP brute force attacks increased on most the cPanel servers. To avoid such attacks, we can simple default FTP account or change FTP port. If you are shared server then client won’t be happy after disabling default FTP which is cPanel login details. There for simply change the FTP port number by using following steps.

1. Log in to server as root user and open default FTP configuration file.

# vi  /etc/pure-ftpd.conf

Search for following line and change it

From
#Bind 127.0.0.1,21

To
Bind 0.0.0.0,121

Note: It means all ip will connect to FTP service on port 121 but make sure that you have opened a port 121 in server firewall and restart the FTP service.

November 26, 2011 Posted by | FTP, Pure-FTPd | , | Leave a comment

How to reset root password in Debian Linux

1. At grub-boot loader screen. Select Recovery mode the version of the kernel that you wish to boot and type e for edit. Select the line that starts with kernel and type e to edit the line.

2. Go to the end of the line and type init=/bin/bash as a separate one word (press the spacebar and then type init=/bin/bash). Press enter key to exit edit mode.

3. Back at the GRUB screen, type b to boot into single user mode. This causes the system to boot the kernel and run /bin/bash instead of its standard init. This will allow us gain root privileges without password.

4. If you wanna reset root password remount partitions

# mount -n -o remount,rw /

# mount -avt nonfs,noproc,nosmbfs

# cd /etc

# passwd

Changing password for user root.
New UNIX password:
Retype new UNIX password:

5. Now, you will get following messages. It means that password for root user has been updated.

passwd: all authentication tokens updated successfully.

6. At last, reboot the server and you are done.

November 25, 2011 Posted by | Tips & Tricks, Unix/Linux | , , | Leave a comment

Joomla FCK editor is not working

Some time Joomla FCK editor is not allowing to add any text after installing Joomla. Refer following steps to sort out the Joomla FCK problems.

1. Open configuration.php file and replace following line

# vi configuration.php

From
var $live_site = ‘http://domain.com’;

To
var $live_site = ‘http://www.domain.com’;

November 24, 2011 Posted by | Joomla | | Leave a comment

Joomla Logged Out when Uploading Image

Issue :-

After apply Suhosin ans SuPHP on cPanel server,  Joomla got a strange behavior.

While upload image through Media Manager, suddenly Joomla logged out.

On error_log I see that it has something crashed with flash.

Solution :-

Just disable flash upload on Global Config –> System –> Enable Flash Uploader

November 23, 2011 Posted by | Joomla | | Leave a comment

Joomla “Not a valid image” issue

While uploading images we are receiving “Not a valid image” error message. To resolve error message refer following steps.

1. First login into Joomla admin section and check box following option. Global Config –> System

– restrict uploads = No
– check mime types = No

2. Second edit configuration.php file and change.

# vi configuration.php

From
var $ftp_enable = ’1′;

To
var $ftp_enable = ’0′;

3. Comment following line in php.ini file if you are using customize php.ini file (mostly used on SuExec server).

# vi /etc/php.ini

;upload_tmp_dir = tmp

4. And now try to upload the image.

November 22, 2011 Posted by | Joomla | | Leave a comment

Joomla “404 component error”

While browsing Joomla site “404 component error” message refer following steps to resolve issue.

1. Login into Joomla admin section

2. Then select Menus –> Menu Item Manager

3. Check box “Home” option from list and then only click on the YELLOW star icon in the upper-right corner.

4. Now browse your site and if you are still having any problem then refer Joomla thread to sort out your issue.

November 21, 2011 Posted by | Joomla | | Leave a comment

How to enable PHP MsSQL extension on cPanel

You can enable mssql extension for php on cPanel server. For this you will need to first install some supporting modules. You will need root access to install it. Before you proceed for installation it is important that you backup your php.ini, http.conf and php.conf file.

1. Below are the required module

i) Txt2man
ii) unixODBC
iii) freeTDS
iv) PHP mssql.so

2. Install unixODBC package

# cd /usr/local/src/

# wget http://www.unixodbc.org/unixODBC-2.2.14-p2.tar.gz

# tar -xvzf unixODBC-2.2.14-p2.tar.gz

# cd unixODBC-2.2.14-p2

# ./configure -prefix=/usr/local -enable-gui=no

# make

# make install

3. Install freeTDS package

# cd /usr/local/src/

# wget ftp://ftp.ibiblio.org/pub/Linux/ALPHA/freetds/stable/freetds-stable.tgz

# tar -xvzf freetds-stable.tgz

# cd freetds-stable

# ./configure -with-tdsver=8.0 -with-unixODBC=/usr/local

# make

# make install

Once installation is completed it will show you configuration file path for freetds.conf note down this path in note pad.

4. Configuration freeTDS, Open file freetds.conf and add following to the bottom.

# vi freetds.conf

[MSHOSTNAME]
host = localhost
port = 1433
tds version = 8.0

5. Generating mssql.so file

# cd /home/cpeasyapache/src/php-x.x.x/ext/mssql/

# phpize

# ./configure

# make

# make install

6. Above steps will create a copy of mssql.so in the installed extension directory. Now locate your php.ini file and add extension as

# vi /etc/php.ini

extension = “mssql.so”

7.  Restarting apache service for php changes to take effect.

# /etc/init.d/httpd restart

Now executing php -m or create phpinfo file you will see mssql is listed in the list.

# php -m

November 20, 2011 Posted by | cPanel, PHP | , , | 1 Comment

How to change the the ownership of a symlink

Just issue the chown command with the option -h. Command will be like this:-

# chown -h username.username /home/<username>/public_html

November 19, 2011 Posted by | Tips & Tricks, Unix/Linux | , , | Leave a comment

How to change Duplex settings of NIC Card

If you are experiencing slow speeds and packet loss on a Linux server, you may need to have the NIC settings restored to full duplex, to accomplish this please do the following:

1. Login to server as root and run the following commands:

# ethtool eth0     (or eth1, etc)

2. If you get a response back from the previous command, do the following:

# ethtool -s eth0 speed 100

# ethtool -s eth0 autoneg off

# ethtool -s eth0 duplex full

3. If you do not get a response back from the ethtool command, you’ll need one of the following:

# mii-tool -rR     (for 100mbit)

# mii-tool -F 10baseT-FD     (for 10mbit)

4. Once the above steps are followed the server speed can be checked using the command as

# mii-tool eth0

Output should be:

eth0: 100 Mbit, full duplex, link ok

5. Accordingly you can change the above 3 commands to make it work in Half duplex mode, or 10 mbps (setting your NIC to 100mbit, if you are only allocated 10mbits will result in your server going offline and will require a Hivelocity technician to console the server).

6. To make the change permanent for 10mbits on Red Hat based systems, add the following to

# vi /etc/sysconfig/network-scripts/ifcfg-eth0

ETHTOOL_OPTS=”speed 10 duplex full autoneg off”

7. For Debian based systems, add the following to

# vi /etc/network/interfaces

up mii-tool -F 10baseT-FD

This will help you resolve packetloss and slow speed issues.

November 18, 2011 Posted by | Tips & Tricks, Unix/Linux | , , | Leave a comment

How to connect Remote PostgreSQL Database

For accessing the pgsql database remotely,  make the following changes in the server.

1) Open the Port 5432 in the server.

# iptables -A INPUT -p tcp –dport 5432 -j ACCEPT

# service iptables restart

If you are using csf firewall, open the port 5432 in /etc/csf/csf.conf and restart csf firewall.

2) Edit the Pgsql configuration file

# vi /var/lib/pgsql/data/postgresql.conf

Make sure that the following entries are there:-

tcpip_socket = true
port = 5432
listen_addresses=’localhost’
Next set IP address(es) to listen on;
you can use comma-separated list of addresses; defaults to
‘localhost’, and ‘*’ is all ip address:
listen_addresses=’*’
Or just bind to 202.54.11.2 and 202.54.11.3 IP address
listen_addresses=’202.54.11.2 202.54.11.3′

3) Edit PostgreSQL HOST ACCESS CONTROL FILE (pg_hba.conf)

# vi /var/lib/pgsql/data/pg_hba.conf

Add the machine IP address from which database is accessing remotely.

local all trust
host all 127.0.0.1 255.255.255.255 trust
host all X.X.X.X 255.255.255.255 trust

Here X.X.X.X  is the machine IP address from which database is accessing remotely.

6. For the connection with ssl add the machine IP in the hostSSL section in the /var/lib/pgsql/data/pg_hba.conf

# vi /var/lib/pgsql/data/pg_hba.conf

Entries will be like this:-

hostssl all all 99.266.122 235 255.255.255.255 trust
host all all 99.266.122.235 255.255.255 trust

November 17, 2011 Posted by | PgSQL | , | Leave a comment

How to Backup & Restore PostgreSQL Database

pg_dump is an effective tool for PostgreSQL through which we can backup postgres database and to restore PostgreSQL database, command psql is enough.

1) Backup postgres database, By ssh to server and execute following command to take backup of database.

# pg_dump -U Db_user Db_name -f database_name.sql

2) Executing above command will prompt you for database password, once password is authenticated database will be backup into file database_name.sql

Note: replace Db_User and Db_name with your actual database user and database name respectively.

3) Restore postgres database

# psql -U Db_user -d Db_name -f mydb.sql

November 16, 2011 Posted by | PgSQL | , | Leave a comment

How to Install PostgreSQL

It is easy to install it via yum or up2date. However, if you need a specific version, it is better to go for rpm installation.

Method-1 :- Using YUM

# yum groupinstall postgresql

Method-2 :- Using UP2DATE

# up2date @ postgresql

Method-3 :- Using RPM

1. You need three rpm.
=======================
postgresql-libs–1PGDG.rhel
postgresql-server–1PGDG.rhel
postgresql–1PGDG.rhel
=======================

2. Download the RPM from rpm.pbone.net for your coresponding OS and the required version.

3. Download it to “/usr/local/src” Directory

4. Install them using

# rpm -ivh postgresql-libs–1PGDG.rhel

# rpm -ivh postgresql-server–1PGDG.rhel

# rpm -ivh postgresql–1PGDG.rhel

5. Once you have completed this you need can start the service.

# /etc/init.d/postgresql start

6. Edit the file ‘/var/lib/pgsql/data/pg_hba.conf’, replace all entries of “ident sameuser” with “trust”.

# vi /var/lib/pgsql/data/pg_hba.conf

ident sameuser” with “trust

7. Edit the file ‘/var/lib/pgsql/data/postgresql.conf’, change the line “max_connections=100? to atleast “max_connections=500?.

# vi /var/lib/pgsql/data/postgresql.conf

max_connections=500

8. Restart PostgreSQL.

# /etc/init.d/postgresql restart

9. If the initialisation fails the files pg_hba.conf and postgresql.conf will not be created. In such a case, perform the following operation. Check the startup log which is found in /var/lib/pgsql/

# chown postgres /var/lib/pgsql/data

# su postgres

# initdb –D /var/lib/pgsql/data

10. To make sure it starts automatically on boot – do the following command

# chkconfig –list

# chkconfig postgresql on

November 15, 2011 Posted by | PgSQL | , | Leave a comment

How to change database encoding value for postgresql database

We can change database encoding values for postgresql database by using following steps but make sure that you have taken backup for current database.

1. Log in to server as root user and switch to postgres

# su postgres

2. To check all database run

# psql -l

3. To switch database for example we are using support_test

# psql -d support_test

4. Run command to check encoding

support_test=# encoding
UTF8

SET CLIENT_ENCODING TO ‘LATIN1′;
or
SET NAMES ‘LATIN1′;

5. Now check encoding

support_test=# SHOW client_encoding;
client_encoding

November 14, 2011 Posted by | PgSQL | , | Leave a comment

PgSQL query failed error

Error:

Warning: pg_query() [function.pg-query]: Query failed: ERROR: permission
denied for relation cg_ref_codes in /home/user/public_html/essencial.php on line 48

Warning: pg_num_rows(): supplied argument is not a valid PostgreSQL
result resource in /home/user/public_html/essencial.php on line 50

Fix:

1. Open the pgsql configuration file.

# vi /var/lib/pgsql/data/pg_hba.conf

local   all         all                                     md5
host    all         all      127.0.0.1  255.255.255.255     md5

2. Edit the file.

local   all         all                                     md5
host    all         all      127.0.0.1  255.255.255.255    password

3. Save it.

4. Restart the postgresql service.

# /etc/init.d/postgresql REstart

November 13, 2011 Posted by | PgSQL | | Leave a comment

Postgres Databases are not being showed on cPanel

We can fix this by modifying /var/lib/pgsql/data/pg_hba.conf from ‘md5? to ‘trust’. It should have the following entries:-

local all all trust
host all all 127.0.0.1 255.255.255.255 trust

Try to access cPanel now. Databases will be showing up on cPanel.

November 12, 2011 Posted by | cPanel, PgSQL | , | Leave a comment

Protected: How to configure MySQL Master-Slave Replica

This content is password protected. To view it please enter your password below:

November 11, 2011 Posted by | MySQL | , | Enter your password to view comments.