Posts

Showing posts from May, 2012

How to install ffmpeg on CentOS or RHEL

To install ffmpeg on CentOS or RHEL/Redhat Enterprise Linux, you need to follow the steps mentioned below: # vi /etc/yum.repos.d/dag.repo Insert the following: [dag] name=Dag RPM Repository for Red Hat Enterprise Linux baseurl=http://apt.sw.be/redhat/el$releasever/en/$basearch/dag gpgcheck=1 enabled=1 Add the /usr/local/lib to /etc/ld.so.conf Then run: # ldconfig -v Then run the following: # rpm -Uvh http://apt.sw.be/packages/rpmforge-release/rpmforge-release-0.3.6-1.el4.rf.i386.rpm # yum update # yum install ffmpeg ffmpeg-devel Done. :)

How to create an FTP Account in Linux

Create a FTP user group. eg: ftpaccounts #/usr/sbin/groupadd ftpaccounts Add a new user to this group, and set the default path of that user to /home/user/. #/usr/sbin/adduser -g ftpaccounts -d /home/user/ testuser Set a password for the newley created user. #passwd testuser Set ownership of /home/user to the testuser and ftpaccounts. #chown testuser:ftpaccounts /home/user Give Read/Write access to testuser and all members in ftpaccounts #chmod 775 /home/user Edit /etc/vsftpd/vsftpd.conf file and make sure 'local_enable=YES' is uncommented. Restart the vsftpd service. #/etc/init.d/vsftpd restart

Outlook mail settings

Sometimes your emails are working fine in your webmail but in any email client, its not working. Please follow the steps given below to verify the email account settings in outlook. 1) Open Outlook, click Tools -> Account Settings 2) Click on the relevant email account and click the Change button at the top of the window 3) Under server information, use the following settings. Incoming mail server: mail.yourdomain.com Outgoing Mail Server: mail.yourdomain.com 4) Click on the More Settings button 5) Select the Outgoing Server tab 6) Check the option "My server requires authentication" 7) Check the option "Use same settings as my incoming mail server" 8) Select the Advanced tab and use port 25 for outgoing port. 9) Incoming port should be 110 for pop3 configuration and 143 for IMAP configuration. 10) Save the configuration by clicking on the Ok button.  The emails should work in Outlook now. If you still find any issue, you need to contact your ser

How to add new servers to Nagios

Steps to add new servers to Nagios: To add a host 1. Go to the folder /usr/local/nagios/etc 2. Add entires in following files. > hosts.cfg > hostgroups.cfg > services.cfg Note: Please make sure that you are backing up these files with date & time before modifying it. To check syntax # cd ../libexec # /usr/local/nagios/bin/nagios -v /usr/local/nagios/etc/nagios.cfg Finally, restart Nagios as given below. Stop Nagios. # /usr/local/etc/rc.d/nagios stop Check whether Nagios is running. # ps aux | grep nagios If so, kill all Nagios. # kill -9 `pgrep nagios` Start Nagios again. # /usr/local/etc/rc.d/nagios start Thank you.

The update of Parallels Panel has failed

Issue: After clicking on ‘Update’ button in Plesk Control Panel, browser opens a new tab at the URL https://server_address:8447. But it never opens and the browser displays a blank page. In Parallels Plesk Panel version 10, port 8447 is used for autoinstaller wizard. Please make sure that port 8447 is not blocked on your server by firewall using the following commands: # iptables -L | grep 8447  # telnet localhost 8447 # netstat -anp |grep 8447 The issue occurred as the service 'autoinstaller' which is used to upgrade Plesk stopped running in the server. This service listens on port 8447. Hence when the service is not running, the connection to it will be refused. Run the following script to fix the issue: ~~~~~~~~~~ # /usr/local/psa/admin/bin/autoinstaller --service-mode=update --enable-xml-output ~~~~~~~~~~ The issue should be fixed now. You need to upgrade Plesk always from the back end to avoid this issue. Thank you.

How to configure private IP in the Linux server

To configure private IP address in a Linux server, you need to edit the file "/etc/sysconfig/network-scripts/ifcfg-eth1" as follows: root@server[~]# vi /etc/sysconfig/network-scripts/ifcfg-eth1 DEVICE=eth1 BOOTPROTO=static ONBOOT=yes IPADDR=YOUR_PRIVATE_IP_ADDRESS NETMASK=255.255.0.0 Give the actual private IP address you want to configure in the section 'IPADDR'. root@server[~]# service network restart Then to get the IP up immediately, or for other distros, run the following command: root@server[~]# ifconfig eth1 PRIVATE_IP netmask 255.255.0.0 root@server[~]# ifconfig eth1 up P.S:- Ubuntu 7/8/9 - Add the above ifconfig commands to rc.local to automatically bring the private lan connection up after reboot. Gentoo 2008 - Add the above ifconfig commands to etc/conf.d/local.start Thank you.

How to configure a Private IP for an OpenVZ VPS

1. Enter the OpenVZ hardware node. 2. To allow the VE to access the rest of the LAN, we must enable forwarding and masquerading, as all activity on the LAN must look like it is coming directly from host (with its IP address). ------------------------------- [host-node]# echo 1 > /proc/sys/net/ipv4/ip_forward [host-node]# iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE -------------------------------- 3. Type the command "vzlist" and find the CTID of the VM in question. 4. Use the following command to add ip address to the VM. ----------------------------- [host-node]# vzctl set CTID --ipadd private_ip --save eg:- [host-node]# vzctl set 101 --ipadd 192.168.2.1 --save ----------------------------- 5. Restart the VM [host-node]# vzctl restart CTID eg:- vzctl restart 101 6. Test the IP address by pinging from the host. Thank you.

ip_conntrack: table full, dropping packet

If you ever see the following error in the 'dmesg' or '/var/log/messages' log files, it means the server is dropping packets and will look like a network issue. ~~~~~~ printk: 167 messages suppressed. ip_conntrack: table full, dropping packet. ~~~~~~ This error has to do with the value in '/proc/sys/net/ipv4/ip_conntrack_max' set to low, and letting the system only handle a few connections at once. This value is usually imposed when APF is installed, and the following should be done to correct it: root@server[~]# echo "138304" > /proc/sys/net/ipv4/ip_conntrack_max add the following to /etc/sysctl.conf: sys.net.ipv4.ip_conntrack_max = 138304 If you are running APF, modify the following line to: SYSCTL_CONNTRACK="138304" To check what the current value is you can use: root@server[~]# cat /proc/sys/net/ipv4/ip_conntrack_max Thank you.

How to partition a disk, set its file system type & mount it

1) To know all the disks attached to VPS/Server type  # parted --list  It will show you all the disk along with the unpartitioned disk. Let, we attached a new disk "/dev/xvdb" to server. It will show "unrecognised disk label" message on "parted --list".  ----  root@server [~] parted /dev/xvdb  GNU Parted 1.8.1  Using /dev/xvdb  Welcome to GNU Parted! Type 'help' to view a list of commands.  (parted) print free  Error: Unable to open /dev/xvdb - unrecognised disk label.  ----  2) Execute the following command to edit disk "/dev/xvdb":  # parted /dev/xvdb  3) Type "mklabel msdos"  It creates a new disk label of type "msdos". The new disk label will have no partitions. This command won't technically destroy your data, but it will make it will make it basically unusable.  ----  (parted) mklabel msdos  ----  4) Type "print free" to know the partition details.  ----  (parted) pri

How to perform file system check

Sometimes you face the issue in which you are getting the error 'Read_only' for your drive. In such case, you need to perform file system check for the specific drive having error using the "fsck" command: You can use the command below to perform fsck. =========== # fsck -Cy /dev/sdaX - replace X with the partition number -C : Displays completion/progress bars -y : Cause the fsck to always attempt to fix any detected filesystem corruption automatically (Assume "yes" to all questions) ============ Example: # umount /dev/sdb # fsck -Cy /dev/sdb # mount /dev/sdb /backup While trying to unmount the drive "Device busy" message was shown. You need to identify the process & kill that process like this: # fuser -m /dev/sdb /dev/sdb:            24519c       # ps ax | grep 24519 24519 ?        DN     0:29 /usr/bin/updatedb -f sysfs?rootfs?bdev?proc?cpuset?binfmt_misc?debugfs?securityfs?sockfs?usbfs?pipefs?anon_inodefs?futexfs?t

How to enable alternative SMTP port in MailEnable

1. Login to the server. 2. Start >> MailEnable Administrator 3. You are presented with MailEnable administration window. 4. Now go to MailEnable Management >> Servers >> localhost >> Connectors 5. Right click "SMTP" and go to properties. 6. Click on the tab "Inbound". 7. Specify the required port in the field "SMTP listens on Port". By default it is 25. If the ISP is blocking the port, you can enable the option "Also listen on alternate port" and specify the alternative port. Thank you.

Mutilple copy emails in Outlook

Regarding multiple copies of getting the same email, we are explaining the possible cause and fixes below. 1. One quite common evil which will end up creating duplicates of email are virus scanner that integrate with Outlook or too strictly configured firewall. When Outlook does a Send/Receive and "thinks" it is talking to a mail server it is in fact talking to the virus scanner. This means that now the virus scanner is responsible for the connection. This means setting up the connection, requesting the list of mails stored on the server, managing the timeouts, etc but also closing the connection properly and telling this to Outlook. Although this could go right of course many many times, keep in mind that you do have added a single point of failure to the Send/Receive process leaving you with another possibility that the connection to the mail server isn’t closed properly and already received e-mail being received again at the next Send/Receive interval. There is no

How to create a ftp user in windows

To create a ftp user in your windows server, you need to follow the steps mentioned below: 1. To add users and also to get the details of the user in the server, you can use the command 'lusrmgr.msc' start >> run >> lusrmgr.msc While running this command you will get the list of users in the server. In order to create a new user, right click on 'users' >> 'New user' and to change the properties of the existing user, right click on the required user and select the 'Properties' 2. Access IIS. This can be done using the command 'inetmgr' start >> run >> inetmgr In IIS, select the corresponding domain inside the 'FTP sites' option and create a sub-directory with the name of the ftp user inside that domain. The document root of the domain is set on domain basis and all the users that come under that domain have their document root same. The document root can be set by 'right click on the domain&#

How to delete spam emails from MailEnable queue in Windows

There are 2 approaches... 1) If you can identify a unique string in the CONTROL file: ... control files are in C:\Program Files\Mail Enable\Queues\SMTP\Outgoing Then CD to C:\Program Files\Mail Enable\Queues\SMTP\Outgoing and run: > for /f "tokens=1 delims=:" %I in ('findstr SOMEstring *MAI') do @del messages\%I >for /f "tokens=1 delims=:" %I in ('findstr SOMEstring *MAI') do @del %I This deletes MESSAGE files first, based on entries found in CONTROL files. 2) If you can identify a unique string in the MESSAGE file: ... message files are in C:\Program Files\Mail Enable\Queues\SMTP\Outgoing\Messages Then CD to C:\Program Files\Mail Enable\Queues\SMTP\Outgoing\Messages and run: > for /f "tokens=1 delims=:" %I in ('findstr SOMEstring *MAI') do @del ..\%I > for /f "tokens=1 delims=:" %I in ('findstr SOMEstring *MAI') do @del %I Thank you.

How to check DOS/DDOS attack in the server

These are few steps to be taken when you feel that the server is under DOS/DDOS attack: Step 1: Check the load in the server using the command "w" or "uptime". Step 2: Check which process is utilizing maximum CPU by "top -cd3" & press SHIFT +M. This will show you the memory usage in decreasing order. Step 3: Check which IP address is taking maximum connection using the command: netstat -alpn | grep :80 | awk '{print $5}' |awk -F: '{print $(NF-1)}' |sort | uniq -c | sort -n Step 4: Check the IP address of the server having maximum connection using the command: netstat -alpn | grep :80 | awk '{print $4}' |awk -F: '{print $(NF-1)}' |sort | uniq -c | sort -n Step 5: Then block the IP address using APF firewall "apf -d <IP address>" or using CSF firewall "csf -d <IP address> Thank you.

How to detect domain under DDOS

We can detect the URL that is referred maximum in the server while DDOS attack, using the 'tcpdump' command. By the following 'netstat' command, we will be able to get the IP address that is having maximum access in the server. ======== netstat -plane | grep :80 | awk {'print $5'} | cut -d ':' -f1 | sort -n | uniq -c | sort -n ======== This will list the IP address as follows : ------------- Count  --- IP address  ------------- From this, take the IP address that is having maximum access and check the connection from this source IP address using the following commands. -------------- tcpdump -A src <IP> -s 500 | grep -i refer -------------- tcpdump -A src <IP> -s 500 | grep -i --color=always refer -------------- -A   ======== is used to print the output in ASCII format src  ======== specify the source IP address here s     ======== to specify the number of hops -c   ======== can also be used to limit the count to a particular value. The bett

How to setup VSFTP with Apache Redhat

Step 1. Execute the following script to install FTP # yum install vsftpd Step 2. Run the following script to configure FTP # vi /etc/vsftpd/vsftpd.conf anonymous_enable=NO # chkconfig vsftpd on Step 3. Create an user to access Apache home directory # useradd -g apache -d /home/user user # passwd user Step 4. Start the service # service vsftpd start Step 5. Set the permissions # vi /etc/group apache:x:##:user Step 6. Create a soft link to Apache home directory # ln -s /var/www/html /home/user/html Step 7. Set permissions in web root # chgrp -R apache * # chown -R apache * # chmod -R 775 * Step 8. VSFTP is now activated. Thank you.

How to create an FTP Account from console

To create an FTP Account from console, you need to follow the steps mentioned below: 1. Login to your server. # ssh root@IP_address_of_your_server 2. Create a FTP user group. eg: ftpaccount # /usr/sbin/groupadd ftpaccount 3. Add a new user to this group, and set the default path of that user to /home/user/. # /usr/sbin/adduser -g ftpaccount -d /home/user/ testuser 4. Set a password for the newley created user. # passwd testuser 5. Set ownership of /home/user to the testuser and ftpaccount. # chown testuser:ftpaccount /home/user 6. Give Read/Write access to testuser and all members in ftpaccount # chmod 775 /home/user 7. Edit /etc/vsftpd/vsftpd.conf file and make sure 'local_enable=YES' is uncommented. 8. Restart the vsftpd service. # /etc/init.d/vsftpd restart Thank you.

How to change MySQL root password from console

To change the MySQL password from console, please follow the mentioned steps: 1. Login to server as root. 2. Kill the MySQL daemons and MySQL processes in the server and run the following commands: root@server[~]$ pkill mysqld root@server[~]$ pkill mysql root@server[~]$ mysqld_safe --skip-grant-tables & root@server[~]$ mysql -u root mysql> use mysql; mysql> UPDATE user SET password=password("newpassword") WHERE user="root"; mysql> flush privileges; mysql> quit; 3. Restart MySQL service Note: Replace newpassword by the actual password. Thank you.

Iptables rule

To delete existing rules: # iptables -F To list existing rules: # iptables -L To whitelist an IP address: # iptables -A INPUT -s  <IP>  -j ACCEPT # iptables -A OUTPUT -s  <IP> -j ACCEPT # service iptables save To blacklist an IP address: # iptables -I INPUT -j DROP -s <IP> # iptables -I OUTPUT -j DROP -s <IP> # service iptables save To unblock an IP address: # iptables -D INPUT -s <IP> -j DROP # iptables -D INPUT -s <IP> -j DROP # service iptables save To open a port range(like 3000 to 5000): # iptables -A INPUT -p tcp --destination-port 3000:5000 -j ACCEPT # iptables -A OUTPUT -p tcp --source-port 3000:5000 -j ACCEPT # service iptables save To redirect all traffic from one IP address to another IP address: # iptables -t nat -A PREROUTING -d <FIRST IP> -j DNAT --to-destination <ANOTHER IP> # service iptables save To allow TCP port 25 for all: # iptables -A INPUT -m state --state NEW -p tcp --dport 2

How to install pdo_pgsql on a cPanel server

In order to install pdo_pgsql on a cPanel server, you need to run the following command: # pecl install pdo_pgsql You can install it from your WHM also. Please follow the steps mentioned below: WHM : Main >> Software >> Module Installers >> PHP Pecl Thank you.

Enable "Update now" link in Awstats

To enable the manual statistics update (“Update now” link) in Awstats, you need to follow the given steps: 1. Open the following file: /home/username/tmp/awstats/awstats.yourdomain.com.conf (substitute username with the actual username of your domain and yourdomain.com with your actual domain name) 2. Look for the following line: AllowToUpdateStatsFromBrowser=0 Change the above value to 1 as follows: AllowToUpdateStatsFromBrowser=1 3. Save your configuration file. Now check your Awstats page on your cPanel. "Update now" link should be present now. Thank you.