HolHost.com Blog Server administrators blog

23Nov/15Off

Basic SSH Linux Commands for every hosting administrator

Here are numerous regular Linux charges that will be useful to you, in the event that you ever even utilize the order line interface in Linux. Most normal clients simply utilize the graphical client interface rather which more often than not has numerous apparatuses and front-finishes to Linux basic summons. This Linux instructional exercise on charge orders will even the normal client in the event that X server accidents, comes up short, is not appropriately designed, and so on. So keep perusing for a portion of the more basic Linux bash charges.

  • ls Displays everything in the current directory
  • ls -a Displays all files, including hidden
  • ls -l Displays all files, along with the size and timestamp
  • tar -zxpf Uncompresses tar.gz files
  • tar -xpf Uncompresses .tar files
  • gunzip Uncompresses .gz files
  • cp /path/to/old /path/to/new Copies a file to a new file
  • mv /path/to/old /path/to/new Moves a file to a new file, or rename
  • mkdir Creates a directory
  • rmdir Deletes a directory
  • rm Deletes a file
  • rm -rf Deletes a directory
  • cd /path/to/dir Moves to a directory
  • cd .. Move up one directory
  • cd ~ Moves to your home directory
  • cd – Moves to the previous directory
  • pwd Displays the present working directory (the one you’re in)
  • pico Edits a file
  • ftp Connect to a FTP server
  • lynx View a webpage
  • df Displays the hard drive stats
  • quota Displays your quota
  • uptime Displays the uptime of the server
  • uname -a Displays the operating system stats
  • whoami Displays your info
  • who Displays others connected to the server
  • last Displays the last login
  • whereis Tells where a file is located
  • BitchX IRC Client
  • mail Check your email
  • ps -x Displays processes your running
  • ps -a Displays all processes running
  • ps -ux Displays running processes, with CPU/Memory usage
  • kill pid# Kills a process
  • kill -9 pid# Kills an eggdrop process
  • killall proc_name Kills all running process of the same type
  • whatis Description of commands
  • man command Displays help on the command (manual)
  • nano Same as Pico (Use yum install nano if it doesn’t first work)
  • Top – gives an overall view of what is going on with the server including memory usage, serve load and running processes “q” to exit top
  • sar -q gives a report of the process list, 1 minute and 5 minute average load every 10 minutes since midnight server time
  • tar -zcf filename.tar.gz file Tars up the file or directory of your choice, replace filename.tar.gzwith the name you want your tar file to have…with the tar.gz extension on the end and replace file with the file or directory you want to tar up. Can also use a path/to/file for both.
  • updatedb – Updates the locate/search DB.

netstat -n -p
Useful to see who is connected to your server, this also resolves hostnames to IP addresses and the -p switch shows you what each person connected is doing and provides a PID for it if there is one… useful if you need to kill something

find / -user username
Replace username with a username of one of your account to find all the files that belong to them. Also useful to add the |more switch so you can scroll one screen at a time. Ever have a client who seems to show a lot more files than are actually in their home directory? This is how you find those files and fix them. Common problem is cpmove files that don’t get properly deleted and get added to a users account.

/scripts/pkgacct2 username
Replace username with a user on your system. This should be done from the home directory. Useful for manually backing up an account if whm copy account doesn’t work. Then just move (mv) the file to a home directory accessible via the web and
chown user.user filename
and chmod to 750 or 755 and you can wget it from a different server if need be.

/scripts/restorepkg username
Once you’ve got the file and need to unpack it you use this command. The file should be in the /home directory to use this though. Remember folks…. username…. not cpmove-username.tar.gz

crontab -e
edit the crontab file and see what is set to run in there.

–help (add to end of the command following a single space)
Such as tar –help, similar to man it digs up info on any given command.

tail -10 filename
gives you the last 10 lines of a file. Can change the # to whatever you want.

cp -R FileOrDirectory path/to/destination
the -R allows you to copy an entire directory to somewhere else.

kill -9
not just for eggdrops… it’s called a “hard kill” and handy for killing off any stubborn process that refuses to die.

whereis filename (use the * as a wildcard or for broader search)
can also use locate or find (although locate is faster)

killall
not just for killing programs.. you can also killall to kill all processes being run by a user. Handy if you have an abuser eating up system resources.

RESTART SERVICES:

service servicename restart

Stop a service:
service servicename stop

Start a service:
service servicename start

Status (doesn’t work on all):
service servicename status

On a RedHat CPanel server, here are the useful services: (CentOS, x10′s default OS for VPSs, is a stripped-down RedHat OS.)
bandmin
chkservd
cpanel
crond
exim
httpd
mysql
named
proftpd

CRON INFO:

Root crontab: (can be used by any user with crontab permissions to edit their crontab. If you are running this as “root” it will edit root’s crontab, and the same goes for any other user. When “bob” runs crontab -e, he will edit his own crontab and not root’s, though he can only edit his own crontab if he has permissions.)
crontab -e

To edit a users cron jobs: (run as a super-user, such as root. not available to regular users.)

crontab -u username -e

Replace username with the actual username of the client you want to edit.

(We’re still talking about RedHat [CentOS] that is running cPanel below. You can do most, if not all, of this from the WHM, so feel free to skip ahead a bit. :P )

  • /scripts/adddns Add a Dns Entry
  • /scripts/addfpmail Install Frontpage Mail Exts
  • /scripts/addservlets Add JavaServlets to an account (jsp plugin required)
  • /scripts/adduser Add a User
  • /scripts/admin Run WHM Lite
  • /scripts/apachelimits Add Rlimits (cpu and mem limits) to apache.
  • /scripts/dnstransfer Resync with a master DNS Server
  • /scripts/editquota Edit A User’s Quota
  • /scripts/finddev Search For Trojans in /dev
  • /scripts/findtrojans Locate Trojan Horses
  • Suggested Usage:
  • /scripts/findtrojans < /var/log/trojans
  • /scripts/fixtrojans < /var/log/trojans
  • /scripts/fixcartwithsuexec Make Interchange work with suexec
  • /scripts/fixinterchange Fix Most Problems with Interchange
  • /scripts/fixtrojans Run on a trojans horse file created by findtrojans to remove them
  • /scripts/fixwebalizer Run this if a user’s stats stop working
  • /scripts/fixvaliases Fix a broken valias file
  • /scripts/hdparamify Turn on DMA and 32bit IDE hard drive access (once per boot)
  • /scripts/initquotas Re-scan quotas. Usually fixes Disk space display problems
  • /scripts/initsuexec Turn on SUEXEC (probably a bad idea)
  • /scripts/installzendopt Fetch + Install Zend Optimizer
  • /scripts/ipusage Display Ipusage Report
  • /scripts/killacct Terminate an Account
  • /scripts/killbadrpms Delete \”Security Problem Infested RPMS\”
  • /scripts/mailperm Fix Various Mail Permission Problems
  • /scripts/mailtroubleshoot Attempt to Troubleshoot a Mail Problem
  • /scripts/mysqlpasswd Change a Mysql Password
  • /scripts/quicksecure Kill Potential Security Problem Services
  • /scripts/rebuildippool Rebuild Ip Address Pool
  • /scripts/remdefssl Delete Nasty SSL entry in apache default httpd.conf
  • /scripts/restartsrv Restart a Service (valid services: httpd,proftpd,exim,sshd,cppop,bind,mysql)
  • /scripts/rpmup Syncup Security Updates from RedHat/Mandrake
  • /scripts/runlogsnow Force a webalizer/analog update.
  • /scripts/secureit Remove non-important suid binaries
  • /scripts/setupfp4 Install Frontpage 4+ on an account.
  • /scripts/simpleps Return a Simple process list. Useful for finding where cgi scripts are running from.
  • /scripts/suspendacct Suspend an account
  • /scripts/sysup Syncup Cpanel RPM Updates
  • /scripts/ulimitnamed RH 6 only. Install a version of bind to handle many many zones.
  • /scripts/unblockip Unblock an IP
  • /scripts/unsuspendacct UnSuspend an account
  • /scripts/upcp Update Cpanel
  • /scripts/updatenow Update /scripts
  • /scripts/wwwacct Create a New Account

 

Empty /tmp folder

rm -R -f /tmp/c*
rm -R -f /tmp/s*
rm -R -f /tmp/p*
rm -R -f /tmp/*_*
rm -R -f /tmp/*-*

Dedicated servers.

12Feb/13Off

How to install CSF

Hello,

We'll guide you thru putting in and configuring CSF - Config Server Firewall, a preferred different to APF. CSF comes with LFD and works with or while not cPanel.

CSF Install Guide and the way To

CSF - Config Server Firewall could be a stateful packet scrutiny firewall, login/intrusion detection and security application for UNIX operating system servers. What will that mean in English? straightforward - it is a program that may greatly improve your dedicated server or VPS's security.

It's a firewall - therefore it will block/restrict ports you do not wish open, and prevents somebody from exploitation any port they require if they did break in.
It has intrusion detection - therefore it'll scan the log files and monitor failing login tries, like FTP word shot and block the science.
Those area unit the two massive things i favor concerning CSF - and it's a pleasant interface for the non tekki person, on cPanel servers.

http://www.configserver.com/cp/csf.html

If you've got another firewall put in, like APF, CSF will assist you mechanically take away the present firewall and install theirs instead. detain mind it will not migrate over your configuration.

Installation
============
Installation is kind of straightforward:

Login because the root user to SSH and run the subsequent commands.

rm -fv csf.tgz
wget http://www.configserver.com/free/csf.tgz
tar -xzf csf.tgz
cd csf
sh install.sh

If you'd wish to disable APF+BFD (which you may ought to do if you've got
them put in otherwise they'll conflict horribly):

sh disable_apf_bfd.sh

That's it. you'll then tack csf and lfd in WHM, or edit the files
directly in /etc/csf/*

Installation Completed

Don't forget to:

1. tack the TCP_IN, TCP_OUT, UDP_IN and UDP_OUT choices within the csf configuration to suite your server

2. Restart csf and lfd

3. Set TESTING to zero once you are pleased with the firewall

csf is preconfigured to figure on a cPanel server with all the quality cPanel
ports open. It conjointly auto-configures your SSH port if it's non-standard on
installation.

You should make sure that kernel work daemon (klogd) is enabled. Typically, VPS
servers have this disabled and you ought to check /etc/init.d/syslog and build
sure that any klogd lines aren't commented out. If you alter the file,
remember to restart syslog.

Now - login to your cPanel server's WHM as root and attend the lowest left menu. If already logged in then reload the page. In Plugins - you may see:  ConfigServer Security&amp;Firewall

The firewall is STOPPED by default - it's not running. we want to designed it, so take it out of check Mode.

Click on Firewall Configuration

ETH_DEVICE =: Set this to eth+

TCP_IN/TCP_OUT/UDP_IN/UDP_OUT = : These area unit the ports you would like to go away open for your server to work. If you alter the default SSH port confirm to feature it here. conjointly add the other services you would possibly have running like Shoutcast or game servers. By default most of the ports used ought to already be designed.

MONOLITHIC_KERNEL = : zero solely amendment this to one if your firewall won't begin - otherwise leave it because it.

LF_DSHIELD = 0: amendment this selection to 86400. this is often associate automatic updated list of acknowledged offensive IPs. sanctioning this can stop them from having the ability to attach to your server.

Spam Protection Alerts
If you would like to feature some spam protection, CSF will facilitate. Look within the configuraiton for the following:

LF_SCRIPT_ALERT = zero amendment this to one. this can send associate email aware of the supervisor once the limit designed below is reached among associate hour.

LF_SCRIPT_LIMIT = one hundred amendment this to 250. this can warn you once associatey scripts sends out 250 email messages in an hour.

Configuration Complete - nearly
Scroll right down to the lowest and click on on amendment to save lots of the settings. Then click Restart csf+lfd

You should see an enormous page of settle for and close to the lowest you ought to see:

csf: TESTING mode is enabled - remember to disable it within the configuration
Starting lfd:[  OK  ]

Click on come back

Now check all of your services to create positive everything is functioning - SSH, FTP, http. once you are doing a couple of fast tests return into the Firewall Configuration page.

TESTING = one amendment this to zero and click on amendment at the lowest. Then Restart csf+lfd

That's it, the firewall is with success put in and running!!
Firewall Status: Running - you ought to see this on the most CSF page in WHM.

Uninstallation
==============
Removing csf and lfd is even a lot of simple:

cd /etc/csf
sh uninstall.sh

15Apr/11Off

Web Hosting Guide for Beginners

First and foremost, for non-IT savvy, it might be a little tough for them to comprehend the meaning of web hosting. I believe if you search it on any search engine, of course there will be answer and explanation for them. But, how far do you really understand? Honestly, when I first get to know this term few years back, I had problem understanding myself. Then, I found one simple explanation that might be easy for people to understand. So, today, if anyone were to ask me what is "web hosting", i'd explain as follows...

Imagine you are homeless and you want to rent a room or buy a house. In order to get a shelter for yourself, you need a room. So, you imagine yourself as the website and the room as the hosting that you need to place yourself in. That means your website need a web hosting. Then, that's the time you start finding yourself a web hosting provider. Here, web hosting provider would be the house owner who rents you the room. So, in order for your website to be available and browsed by Internet users, you need to make sure your website is hosted in a web server provided by a web hosting provider.

So, when you finally understand what web hosting is, next will be the time to find out more about the different types of web hosting available. You have shared hosting, dedicated hosting, reseller hosting, VPS hosting, and colocation hosting. You name it, the Internet has it! So many to remember and differentiate..so, let's get the ball rolling with...

Shared Hosting
Shared hosting means that a web server has its resources shared by many other websites. Or you can put it as, in a house, there are many tenants. Usually small or normal e-commerce businesses will choose this type of hosting. Websites with high traffic might not be able to choose this type of hosting due to insufficient webspace.

Dedicated Hosting
Dedicated hosting refers to hosting in which you rent a server from your web hosting provider and will be placed at your web hosting provider's datacentre. They will provide software installation and connection to Internet. This will indicates that the website owner has control over the server as they don't share it with other websites. In short, dedicated hosting is where only 1 user hosted on the server machine and have a full privilege over the server to manage it by themself. The server machine will be still belongs to the web hosting provider.

Colocation Hosting
Well, this hosting has the features which are almost the same as dedicated hosting EXCEPT that you provide your own server and web hosting provider just help you to plug it into their datacentre. You need to install own software and hardwares. Everything is DIY.

Reseller Hosting
Reseller Hosting is a hosting where the account owner has the priviledge to allocate the webspace and bandwidth access and resell them to his clients. This shows that reseller hosts act like a middleman and is usually not responsible for any software or hardware intallation. They only buy webspace and resell to clients.

VPS Hosting
VPS stands for Virtual Private Server. It is almost the same as dedicated server. Hence, it's sometimes called Virtual Dedicated Server. Generally, it means that the account owner has the feeling as though his owns a dedicated server. In real sense, it's actually separating a physical server into several independent hosting spaces or VPS-es, each isolated from the other.This will allow you to create and manage multiple sites and domains and take full control of your VPS with root/administrator access which allows you to access the virtual hard disk, RAM and to reboot your private server independently from other VPS-es.

Domain Name
After we are done with the different types of hosting, there is something else which I want to touch on. It is none other than the "domain name". So, ever wonder what is domain name? Wow, sounds technical? Not really actually. Don't be scared. Last time, when I saw the words domain name, it freaked me out too. Now, when I got used to it, it's not that nerve-wracking after all. So, domain name is just the normal web address or url (Uniform Resource Locator) you type in the "address" area when you open a browser. Examples of domain name are "exabytes.com". You know? Just the normal web address. Well, since it's a web address, it's a unique name. Hence, there will be no other same domain name. In fact, domain name is actually corresponding with numeric IP address. So, every domain name will have its numeric IP address. For example, the IP address for exabytes.com is 72.18.131.206

When you see exabytes.com, ever wonder ".com" stands for what? It actually stands for commercial. Whenever you see .com, .org, .net or others which ends after the final dot or period (.) of a url, it is known as top-level domain. It actually tells you what kind of website it is, indirectly. And the commonly used domain name extension nowadays will be .org, .net, .com. However, there are a lot of new domain extension up for grab lately such as .aero, .info, .museum, and .name. Next in the list that I shall explain is, Country Level Domain Name. Examples of country level domain name is exabytes.com.my. It has ".my" as its country code top-level domain (ccTLD). .my here represents the country "Malaysia". Of course, different country will have different ccTLD. For example, .jp stands for Japan, .au for Australia, .ca for Canada.

There are more to learn in order to excel in web hosting industry. Hopefully this simple guide will help all those novice out there. There are other things you need to know as well. But, it will be in my next article.