Posts Under Category: Tutorials

If you want to see the list of users who are logged in server and their IP and what they are doing, here is how you can do.

Login to your server as root and run following command.

w

OR

who

Above command will list all logged in users, their IP, what they are doing.

Our Recommended VPS Hosting

If for some reason you do not want to update your server kernel but want to update other packages running on CentOS, here is how you can do.

Update can be done using yum command and to exclude kernel from update we need to add exclude command.
Login to your server as root via SSH and run following command:

yum -y --exclude=kernel\* update

OR

yum -y -x 'kernel*' update

Above command will update all packages but will leave kernel update on a CentOS server.

Our Recommended VPS Hosting

For security reason, it is recommended that you disable directory listings / indexing on your server. Apache default configuration comes with this feature enabled but its always a good idea to get it disabled unless you really need it.

When this option is enabled, user can see the list of files / folder of a directory when no index file is present.
apache-directory-index

With Apache listings / indexing option disabled, user will not be able to see content of a directory in absence of a index file.

Here is how you can disable this on a cPanel server.

Step 1

Login to your server WHM as root.

Step 2

Navigate to:
WHM Main >> Service Configuration >> Apache Configuration >> Global Configuration

Step 3

Under Directory ‘/’ Options >> uncheck Indexes >> Save >> Restart Apache

apache-directory-index-2

Done!!

Our Recommended VPS Hosting

You have moved your WordPress website to a new server / hosting provider, and all pages on your WordPress website are giving 404 page not found error. This solution may fix your problem.

Login in WordPress Admin Dashaboard and navigate to:

Settings >> Permalink

And click Save changes button with same settings.
Check your website now. That should solve your problem.

Our Recommended Hosting

This tutorial explains how you can start and stop firewall on a CentOS / RedHat Linux server.

How to Stop / Disable firewall

Below commands will stop / disable firewall of a redhat / centos server. Login to your server as root via SSH and run following commands:

service iptables save
service iptables stop
chkconfig iptables off

For IPv6 firewall, use below commands:

service ip6tables save
service ip6tables stop
chkconfig ip6tables off

How to start firewall

Run below commands to start firewall.

chkconfig iptables on
service iptables start

For IPv6 firewall, use below commands:

chkconfig ip6tables on
service ip6tables start

Our Recommended VPS Hosting

This tutorial explains how you can list all current iptables rules on a RedHat / CentOS Linux server, and how you can clear / flush current iptables rules.

How to list current iptables rules

Below command will list of current iptables rules of your CentOS / RedHat Linux server.

iptables -L

How to Clear / Flush iptables rules

Use below command to delete / clear / flush all current iptables rules of your CentOS / RedHat Linux server.

iptables -F

If your server went down after flushing iptables, please refer to following tutorials:
Solution – Server Down after Flushing IPtables

Our Recommended VPS Hosting

This tutorial explains how you can start, stop and restart iptables rules of your server firewall. This tutorial is applicable for CentOS / RedHat Linux servers.

How to start iptable

service iptables start

OR

/etc/init.d/iptables start

How to stop iptable

service iptables stop

OR

/etc/init.d/iptables stop

How to restart iptable

service iptables restart

OR

/etc/init.d/iptables restart

Our Recommended VPS Hosting

Recently one of my vps (CentOS) went down after flushing / clearing iptables rules using below command:

iptables -F

The above command will flush/clear all current firewall rules of your CentOS / Linux server.

Here is how I fixed it. I just restarted iptables rules using below command and my VPS was UP.

service iptables restart

You can also use below command to restart iptables rules.

/etc/init.d/iptables restart

Our Recommended VPS Hosting

If you want to copy a file / folder from one server to another, you can use wget or scp command. In this tutorial I will show how to use scp command to copy files / folder from one server to another.

Let us suppose

Server One IP is: 1.1.1.1
Server Two IP is: 2.2.2.2

How to copy a file

Suppose you want to copy a file from server one to server two.
Location of file on server one is: /home/filename.txt

Login to server two via SSH and run following command

scp root@1.1.1.1:/home/filename.txt /home/

This will copy filename.txt file from server one to server two and save in /home directory.

How to copy a folder / directory

Suppose you want to copy a complete folder from server one to server two.
Let’s say you want to copy /backup folder from server one to server two.

Login to server two via SSH and run following command

scp -r root@1.1.1.1:/backup /foldername

This will copy /backup directory from server one to server two and save in /foldername directory.

Our Recommended VPS Hosting

We can test server disk read / write speed from SSH. Below command will show the speed that the server can read and write a 1GB file.

Login to your server via SSH and run below command:

dd if=/dev/zero of=sb-io-test bs=1M count=1k conv=fdatasync

Higher scores is better.

SSD disk will give you very fast read / write speed compared to SATA disks. There are many providers offering SSD VPS like DigitalOcean, RamNode etc

Our Recommended VPS Hosting