Cisco VPN on CentOS 6

Install eplel repo


# rpm -ivh http://mirror.vcu.edu/pub/gnu+linux/epel/6/i386/epel-release-6-8.noarch.rpm


# yum -y install vpnc
# chmod 700 /etc/vpnc/vpnc-script
# cp /etc/vpnc/default.conf /etc/vpnc/default.conf.orig

Save your .pnc file from Networking to /etc/vpnc/ folder

Install the VPN .pnc file as a default.conf file

Get the pcf to vpnc configuration file converter


# wget http://svn.unix-ag.uni-kl.de/vpnc/trunk/pcf2vpnc

Make it executable


# chmod +x pcf2vpnc

Move it to a place in our path


# mv pcf2vpnc /usr/local/bin/


# cd /etc
# pcf2vpnc /path/username.pcf default.conf
# chown root:root default.conf
# chmod 600 default.conf

Edit the config file to either use your username and password, or to manually enter


# nano default.conf
# Uncomment for auto login
# Xauth username myusername
# Xauth password userpass
# Uncomment for manual login
Xauth interactive

Backup resolv.conf

As a final configuration step, it is a good idea to make a backup of your resolv.conf file. The vpnc program will replace the resolv.conf upon connection and will restore it when you disconnect.

Connect and Disconnect

You must be logged in as Root for this to work

# vpnc
# vpnc-disconnect

How can i know which account is usinig a lot of cpu or ram in my server?

For cPanel

Main >> System Health >> Show Current CPU Usage
It will show what user is taking most cpu. However, if you suPHP is not installed on your server, you will not able to see username. It will show you just nobody user.

remote ssh

Use “top –c” and nice top to find out the process that is causing high load on the server. Get the process id and then check who owns the process running in the server.

top --c
cd /proc/<process id>
ls -l 

The above command will give the link to the directory from which the script is running. Also try installing suphp in the server.

There are various ways to checkout the processes using high percentage of CPU and RAM, like

1) WHM >> Apache Status : it will show you each request to your website + it’s CPU and RAM usage.
2) ps -auxf : it will list all the current processes running on the server + it’s CPU and RAM usage
3) top c : same as above but shows a real time view of all the processes and resource usage

Load monitoring commands

1)top -c you will see the resource usage in percentage like Memory, CPU etc.Also server load details. And pstree -pua command list the processes in the server.
2) If say a user is listed high in the above command with higher resource usage the command

ls -alh /proc/<id> |grep cwd

Where is the process id of the user. This command gives the working directory of the script.
3) Check WHM interfaces
Main >> Server Status >> Daily Process Log
Main >> Server Status >> Apache Status

Some of the security tips that will help you is :-

1) enable suPHP
2) enable mod_security
3) also close some of the security holes in the php functions using the php disable_functions.

is there any command to show the Users with CPU and Memory usages ?
Use top -c d2 -u “username” as an example top -c d2 -u mylogwp

How do I include lines in resolv.conf that won’t get lost on reboot?

It’s probably better to have your DNS server be able to resolve ‘puppet’ to the right address, and either to have your DHCP server hand out the DNS nameserver address and search list or else (if you have static IP addresses) to have something like the following in /etc/network/interfaces.

iface eth0 inet static
address 192.168.3.3
netmask 255.255.255.0
gateway 192.168.3.1
dns-search example.com
dns-nameservers 192.168.3.45 192.168.8.10

But if you do want to do it via the resolvconf configuration files you will want to edit /etc/resolvconf/resolv.conf.d/base. In that file, put in your info as you would in resolv.conf.

nameserver 192.168.1.XXX

Then tell resolvconf to regenerate resolv.conf.

sudo resolvconf -u

How To Set Up Apache Virtual Hosts on Ubuntu 12.04 LTS

About Virtual Hosts
Virtual Hosts are used to run more than one domain off of a single IP address. This is especially useful to people who need to run several sites off of one virtual private server. The sites display different information to the visitors, depending on with which the users accessed the site.There is no limit to the number of virtual hosts that can be added to a VPS.
Set Up
The steps in this tutorial require the user to have root privileges. You can see how to set that up in the here Initial Server Setup. You can implement whatever username suits you.

Continue reading How To Set Up Apache Virtual Hosts on Ubuntu 12.04 LTS

How To Set Up Apache Virtual Hosts on CentOS 6

About Virtual Hosts
Virtual Hosts are used to run more than one domain off of a single IP address. This is especially useful to people who need to run several sites off of one virtual private server. The sites display different information to the visitors, depending on with which the users accessed the site.There is no limit to the number of virtual hosts that can be added to a VPS.

Continue reading How To Set Up Apache Virtual Hosts on CentOS 6

Kill stuck Windows service using sc queryex and taskkill

Windows Services can sometimes have a nasty habit of getting stuck in the stopping or starting state. Some believe that at this point there is no alternative but to reboot the server to clear the problem.

However, the following trick usually will work.

The first step is to right click and select Properties on the offending Windows Service in order to find the actual Service Name.

Ex: Services > Microsoft FTP service

Start > Administrative Tools > Services

Screenshot

The next step is to do an sc queryex on the Windows Service in order to find the Process ID.

sc queryex ftpvc

Screenshot-1

The Process ID is 5180.  So now we can issue the taskkill /F command on the process.

taskkill /PID 6524 /F

Screenshot-2

Another thing to remember: in Windows 2008, if we are not running the command prompt with ‘run as administrator’, we will get an access denied error on the delete.

Horde fails with large attachments

Is you Horde email failing due to file size attachments? Check the php.ini file in horde:

[root@server ~]# grep upload_max_filesize /etc/psa-webmail/horde/horde/php.ini
upload_max_filesize = 5M

Now edit the file:

[root@server ~]# nano /etc/psa-webmail/horde/horde/php.ini
upload_max_filesize = 5M
Change to required value
upload_max_filesize = 128M

Save and exit and restart horde
SERVICE HORDE RESTART

Now check the php config file - php.ini for max_uploads and max_post
grep max_file_uploads /etc/php.ini
max_file_uploads = 99999