A Sysadmin's Blog

Cpanel/WHM, Plesk, DirectAdmin, Webmin, Web hosting, & Much more...

About Me :)

Posted by nakuls77 on September 14, 2008
Posted in: Welcome :). Leave a Comment

Hi Folks,

I’m Nakul M.  A Linux System administrator from India, I’ve created this blog as this would surely help me as well as colleagues when they’ve a task on hand.

If anyone has comments they can directly be mentioned under the post and any suggestions too.

You can contact me by emailing me at nakuls77@gmail.com I’ll be waiting for your comments & suggestions to my inbox too.

All the contents in my blog maybe found anywhere on the internet as the world is really small place especially on Google :)

So my request for all of you is not to think that the posts are ripped off, but just think that it’s a collection of helpful articles.

Thank you.
Nakul M.
Author nakuls77.wordpress.com

Install TeamSpeak Server

Posted by nakuls77 on January 22, 2012
Posted in: Linux/UNIX. Leave a Comment

TeamSpeak is a quality, scalable application which enables people to speak with one another over the Internet. TeamSpeak consists of both client and server software. The server acts as a host to multiple client connections, capable of handling literally thousands of simultaneous users. This results in an Internet based conferencing solution that works in a variety of applications such as team mates speaking with one another while playing their favorite online game, small businesses cutting costs on long distance charges, or for personal communication with friends and family. (TeamSpeak)


First add the user teamspeak, then install teamspeak. You should install this under the user and start the servers under a non privileged user.

# adduser teamspeak
# su teamspeak
# cd /home/teamspeak
# wget ftp://ftp.freenet.de/pub/4players/teamspeak.org/releases/ts2_server_rc2_202319.tar.bz2

# tar -xvjf ts2_server_rc2_202319.tar.bz2
# cd tss2_rc2
# ./teamspeak2-server_startscript start

 

Check server.log:
# grep “password” server.log

Try to find something like this (username and password):
WARNING,Info,SERVER, admin account info: username: admin password: xxxxxxxx-xx-xx

WARNING,Info,SERVER, superadmin account info: username: superadmin password: xxxxxx

Now you can access to the web interface
http://serverip:14534

 Click on SuperAdmin Login, then fill in the details provided in server.log

If you want to add a server, just select servers from the left menu, then click Add Server ButtonFill in the boxes and set the port at the bottom.

Starting the server:
Select servers from the left menu and click Start

Now you can connect to the server via your teamspeak client.

Hide BIND version

Posted by nakuls77 on January 22, 2012
Posted in: Linux/UNIX. Leave a Comment

Login as root to your sever.

Edit named.conf configuration:
# nano /etc/named.conf

If you find a options function add this line to it:
version “some version”;

If that function does not exist, just add it:
options {version “some version”;};

Save and Exit

Restart your BIND service to take the change.
# /etc/init.d/named restart

How to add Frame Forwarding to your website

Posted by nakuls77 on January 22, 2012
Posted in: Others. Leave a Comment

To add frame forwarding to your website, create your html file (usually index.html) with the following code.

 


Your browser does not support frames

</body>
</noframes>
</frameset>
</html>

 


Replace all bold items with the values you wish to use.

 


<html><head><title>Title of your webpage</title></head>
<frameset cols=”*”>
<frame name=”main” src=http://www.xxxxxxxxx.com scrolling=”auto” noresize>
<noframes>
<body>

How to Email Account Configuration [Microsoft Outlook 2003]

Posted by nakuls77 on January 22, 2012
Posted in: Outlook Express. Leave a Comment
Procedure to be followed:
1. Open your Microsoft Outlook 2003 software.
2. In the Tools menu, you click on “E-mail Accounts …”
3. In the window, select the box: Add new Email account. And click on Next.
- Click on the Add button
4. Click the POP3 box. And click on Next.
5. Enter your information for your email account. Then, click on Next.
• Your Name
The complete name which will be posted
• Email Addresse
Your complete email addresse
• User Name
Your complete email addresse
• Password
Your email password
• Incoming mail server (POP3)
This one always starts with mail. and follows-up with your domain name ex: mail.domain.com
• Outgoing mail server (SMTP)
Register your Internet providers (IP) SMTP
6. The configuration of your email account is now completed.

How to ROBOTS.TXT File Use

Posted by nakuls77 on January 22, 2012
Posted in: Others. Leave a Comment

nformations:

The robots.txt file enables you to restrict the access to Search engines, certain pages or files of your Web site. This will enable you to control the information indexed by your Web sites search engine.


 

1. You must create a text file (.txt) named: robots.txt.

2. You must insert the desired commands in this file to inform the search engines what must be indexed or not.

3. You insert your file in the “root” of your Web site. Example: In the file /public_html/ (linux) or /www/ (Windows).

You should see your file if you type: http://www.yourdomain.tld/robots.txt

4. Here is an example.

Exemple:
User-agent: *
Disallow: /cgi-bin/

In this example to prevent “All” search engines from indexing the contents in the /cgi-bin/ file.

- On the 1st line Use-agent: The star * indicates all the search engines.

- On the line 2nd line Disallow: you register the name of the file with the slashes (/).

5. Here is a small list of commands used for the 1st line:

 

User-agent: *

Includes all the search engines

User-agent: Googlebot

Includes only the Google search engine

User-agent: MSNBot

Includes only the MSN search engine

User-agent: Slurp

Includes only the Yahoo!search engine

User-agent: Fast

Includes only the Lycos and Fast/Alltheweb search engine

6. Here is small list of possible commands for the 2nd line:

 

Disallow: /

Allows to exclude all the pages from the Web site (no possible aspiration).

Disallow:

Allows not to exclude any page from the server (no constraint).

Empty or non-existent a robots.txt file will have an identical consequence.

Disallow: /cgi-bin/

Excludes all what contains the cgi-bin file to be indexed.

Disallow: /*.[extension de fichier]$

Excludes all types of file extensions indicated to be indexed.

Ex: Disallow: /*.pdf$

Disallow: /cgi-bin/ Excludes all what contains the cgi-bin file to be indexed.
Disallow: /*.[extension de fichier]$ Excludes all types of file extensions indicated to be indexed.
Ex: Disallow: /*.pdf$

7. You can register several Disallow lines as shown in this example:

User-agent: *
Disallow: /cgi-bin/
Disallow: /images/
Disallow: /secure/

Therefore, in this case you exclude the content of these 3 files from All search engines.

8. You can also personalize and command the various search engines:

User-agent: *
Disallow:
User-agent: Googlebot
Disallow: /cgi-bin/

In this case first of all you authorize all search engines to index the Web site. But in secondly you prohibit Google the /cgi-bin/ file.

Do not forget that it is necessary to register META beacons in each page which will be indexed to inform the robots: (here are some examples)

 

<META NAME=”MSNBot” CONTENT=”noindex” />

Prohibited MSNBot to index a page.

<META NAME=”*” CONTENT=”noindex” />

Prohibited all robots to index a page.

<META NAME=”Googlebot” CONTENT=”nofollow” />

Prohibited GoogleBot to follow links on a page.

<META NAME=”robots” CONTENT=”nofollow” />

Prohibited all robots to follow links on a page.

<META NAME=”MSNBot” CONTENT=”noindex,nofollow” />

Prohibited MSNBot to index and follow links.

<META NAME=”GoogleBot” CONTENT=”nocache” />

<META NAME=”GoogleBot” CONTENT=”noarchive” />

Prohibited Googlebot Cache.

Prohibited Googlebot Archive.

How to use SSH

Posted by nakuls77 on January 22, 2012
Posted in: Linux/UNIX. Leave a Comment

Infomations:

SSH is a tool used to connect to your server. This is how 95% of your system is setup.

To use ssh, you’ll need an ssh client for your local computer. We recommend PuTTY


Common SSH Commands or Linux Shell Commands,
ls : list files/directories in a directory, comparable to dir in windows/dos.
ls -al : shows all files (including ones that start with a period), directories, and details attributes for each file.

cd : change directory · · cd /usr/local/apache : go to /usr/local/apache/ directory
cd ~ : go to your home directory
cd - : go to the last directory you were in
cd .. : go up a directory cat : print file contents to the screen
cat filename.txt : cat the contents of filename.txt to your screen

chmod: changes file access permissions
The set of 3 go in this order from left to right:
USER – GROUP – EVERONE

0 = —  No permission
1 = –X  Execute only
2 = -W-  Write only
3 = -WX  Write and execute
4 = R–  Read only
5 = R-X  Read and execute
6 = RW-  Read and write
7 = RWX  Read, write and execute

Usage:
chmod numberpermissions filename

chmod 000 : No one can access
chmod 644: Usually for HTML pages
chmod 755: Usually for CGI scripts

chown: changes file ownership permissions
The set of 2 go in this order from left to right:
USER – GROUP

chown root myfile.txt : Changes the owner of the file to root
chown root.root myfile.txt : Changes the owner and group of the file to root

tail : like cat, but only reads the end of the file
tail /var/log/messages : see the last 20 (by default) lines of /var/log/messages
tail -f /var/log/messages : watch the file continuously, while it’s being updated
tail -200 /var/log/messages : print the last 200 lines of the file to the screen

more : like cat, but opens the file one screen at a time rather than all at once
more /etc/userdomains : browse through the userdomains file. hit Spaceto go to the next page, q to quit

pico : friendly, easy to use file editor
pico /home/burst/public_html/index.html : edit the index page for the user’s website.

File Editing with VI ssh commands
vi : another editor, tons of features, harder to use at first than pico
vi /home/burst/public_html/index.html : edit the index page for the user’s website.
Whie in the vi program you can use the following useful commands, you will need to hit SHIFT + : to go into command mode

:q! : This force quits the file without saving and exits vi
:w : This writes the file to disk, saves it
:wq : This saves the file to disk and exists vi
:LINENUMBER : EG :25 : Takes you to line 25 within the file
:$ : Takes you to the last line of the file
:0 : Takes you to the first line of the file

grep : looks for patterns in files
grep root /etc/passwd : shows all matches of root in /etc/passwd
grep -v root /etc/passwd : shows all lines that do not match root

ln : create’s “links” between files and directories
ln -s /usr/local/apache/conf/httpd.conf /etc/httpd.conf : Now you can edit /etc/httpd.conf rather than the original. changes will affect the orginal, however you can delete the link and it will not delete the original.

last : shows who logged in and when
last -20 : shows only the last 20 logins
last -20 -a : shows last 20 logins, with the hostname in the last field

w : shows who is currently logged in and where they are logged in from.
who : This also shows who is on the server in an shell.

netstat : shows all current network connections.
netstat -an : shows all connections to the server, the source and destination ips and ports.
netstat -rn : shows routing table for all ips bound to the server.

top : shows live system processes in a nice table, memory information, uptime and other useful info. This is excellent for managing your system processes, resources and ensure everything is working fine and your server isn’t bogged down.
top then type Shift + M to sort by memory usage or Shift + P to sort by CPU usage

ps: ps is short for process status, which is similar to the top command. It’s used to show currently running processes and their PID.
A process ID is a unique number that identifies a process, with that you can kill or terminate a running program on your server (see kill command).
ps U username : shows processes for a certain user
ps aux : shows all system processes
ps aux –forest : shows all system processes like the above but organizes in a hierarchy that’s very useful!

touch : create an empty file
touch /home/burst/public_html/404.html : create an empty file called 404.html in the directory /home/burst/public_html/

file : attempts to guess what type of file a file is by looking at it’s content.
file * : prints out a list of all files/directories in a directory

du : shows disk usage.
du -sh : shows a summary, in human-readble form, of total disk space used in the current directory, including subdirectories.
du -sh * : same thing, but for each file and directory. helpful when finding large files taking up space.

wc : word count
wc -l filename.txt : tells how many lines are in filename.txt

cp : copy a file
cp filename filename.backup : copies filename to filename.backup
cp -a /home/burst/new_design/* /home/burst/public_html/ : copies all files, retaining permissions form one directory to another.
cp -av * ../newdir : Copies all files and directories recurrsively in the current directory INTO newdir

mv : Move a file command
mv oldfilename newfilename : Move a file or directory from oldfilename to newfilename

rm : delete a file
rm filename.txt : deletes filename.txt, will more than likely ask if you really want to delete it
rm -f filename.txt : deletes filename.txt, will not ask for confirmation before deleting.
rm -rf tmp/ : recursively deletes the directory tmp, and all files in it, including subdirectories. BE VERY CAREFULL WITH THIS COMMAND!!!

TAR
: Creating and Extracting .tar.gz and .tar files
tar -zxvf file.tar.gz : Extracts the file
tar -xvf file.tar : Extracts the file
tar -cf archive.tar contents/ : Takes everything from contents/ and puts it into archive.tar
gzip -d filename.gz : Decompress the file, extract it

ZIP Files:  Extracting .zip files shell command
unzip file.zip

Firewall - iptables commands
iptables -I INPUT -s IPADDRESSHERE -j DROP : This command stops any connections from the IP address
iptables -L : List all rules in iptables
iptables -F : Flushes all iptables rules (clears the firewall)
iptables –save : Saves the currenty ruleset in memory to disk
service iptables restart : Restarts iptables

Apache Shell Commands
httpd -v : Outputs the build date and version of the Apache server.
httpd -l : Lists compiled in Apache modules
httpd status : Only works if mod_status is enabled and shows a page of active connections
service httpd restart : Restarted Apache web server

MySQL Shell Commands
mysqladmin processlist : Shows active mysql connections and queries
mysqladmin drop databasenamehere : Drops/deletes the selected database
mysqladmin create databasenamehere : Creates a mysql database

Restore MySQL Database Shell Command
mysql -u username -p password databasename < databasefile.sql : Restores a MySQL database from databasefile.sql

Backup MySQL Database Shell Command
mysqldump -u username -p password databasename > databasefile.sql : Backup MySQL database to databasefile.sql

kill: terminate a system process
kill -9 PID EG: kill -9 431
kill PID
EG: kill 10550
Use top or ps ux to get system PIDs (Process IDs)

EG:

PID TTY TIME COMMAND
10550 pts/3 0:01 /bin/csh
10574 pts/4 0:02 /bin/csh
10590 pts/4 0:09 APP

Each line represents one process, with a process being loosely defined as a running instance of a program. The column headed PID (process ID) shows the assigned process numbers of the processes. The heading COMMAND shows the location of the executed process.

Putting commands together
Often you will find you need to use different commands on the same line. Here are some examples. Note that the | character is called a pipe, it takes date from one program and pipes it to another.
> means create a new file, overwriting any content already there.
>> means tp append data to a file, creating a newone if it doesn not already exist.
< send input from a file back into a command.

grep User /usr/local/apache/conf/httpd.conf |more
This will dump all lines that match User from the httpd.conf, then print the results to your screen one page at a time.

last -a > /root/lastlogins.tmp
This will print all the current login history to a file called lastlogins.tmp in /root/

tail -10000 /var/log/exim_mainlog |grep domain.com |more
This will grab the last 10,000 lines from /var/log/exim_mainlog, find all occurances of domain.com (the period represents ‘anything’,
– comment it out with a so it will be interpretted literally), then send it to your screen page by page.

netstat -an |grep :80 |wc -l
Show how many active connections there are to apache (httpd runs on port 80)

mysqladmin processlist |wc -l
Show how many current open connections there are to mysql

Partition /var is Full [DirectAdmin]

Posted by nakuls77 on January 22, 2012
Posted in: Direct Admin. Leave a Comment

If you have a /var partition, and if that partition is too small it may fill up quickly. If you want to move the data which is stored in “/var” to another partition, run the following:

 

cd /var
du | sort -n

This will give you a full readout of all the directories that are using the most space. The directory using the most disk space will appear at the bottom of the list.

One common culprit is mysql (/var/lib/mysql on Redhat). To move that path to another partition, run the following:

 

cd /home
mkdir mysql
chown mysql:mysql mysql
cd mysql
/sbin/service mysqld stop
cp -Rp /var/lib/mysql/* .
cd /var/lib
mv mysql mysql_old
ln -s /home/mysql ./mysql
/sbin/service mysqld start

 

#once satisfied that mysqld is running, remove the old data:
rm -rf mysql_old

Spamassassin : Can’t locate HTML/Parser.pm in @INC

Posted by nakuls77 on January 22, 2012
Posted in: Direct Admin. Leave a Comment

If you are trying to install Spamassassin but get that error, then it means you require the HTML/Parser.pm perl module.

RedHat:

 

perl -MCPAN -eshell
install HTML::Parser

 

If that gives you problems, run “unset LANG” then try again.

FreeBSD:

 

cd /usr/ports/www/p5-HTML-Parser
make install clean

 

or to manually compile from source for either OS:

 

wget http://search.cpan.org/CPAN/authors/id/G/GA/GAAS/HTML-Parser-3.35.tar.gz
tar xvzf HTML-Parser-3.35.tar.gz
cd HTML-Parser-3.35
perl Makefile.PL
make
make install

 

Disk Usage is showing 0.00 [DirectAdmin]

Posted by nakuls77 on January 22, 2012
Posted in: Direct Admin. Leave a Comment

DirectAdmin relies on the system quotas to return a value for how much space is being used. DirectAdmin will run

 

/usr/sbin/repquota /home

 
Where /home is the quota_partition value set in the /usr/local/directadmin/conf/directadmin.conf file (eg, /home, / or /usr). The command should output a large list of numbers, eg

 

[root@server]# /usr/sbin/repquota /home
*** Report for user quotas on device /dev/hda3
Block grace time: 7days; Inode grace time: 7days
Block limits File limits
User used soft hard grace used soft hard grace
———————————————————————-
root — 417796 0 0 7446 0 0
nobody — 4 0 0 1 0 0
bin — 56880 0 0 510 0 0
majordomo — 8 0 0 2 0 0
diradmin — 8 0 0 2 0 0
admin — 200 0 0 44 0 0
user123 — 100 0 0 22 0 0
user456 — 100 0 0 22 0 0

 
If the “used” column is not showing anything, or users are not in the list, then you’ll need to run the quotacheck program:

Redhat:

 

/sbin/quotaoff -a; /sbin/quotacheck -avugm; /sbin/quotaon -a;

FreeBSD:

 

/usr/sbin/quotaoff -a; /sbin/quotacheck -avug; /usr/sbin/quotaon -a;

 
If are getting errors and no output is displayed for the repquota command, you’ll need to check your /etc/fstab file to make sure that it contains the rw,userquota,groupquota line beside the partition that is using the quotas.
*Important: On Linux (Redhat/Debian), it’s usrquota,grpquota, and on FreeBSD it’s userquota,groupquota.

Sample /etc/fstab:

 

# Device Mountpoint FStype Options Dump Pass#
/dev/ad0s1a / ufs rw,userquota,groupquota 1 1
/dev/ad0s1e /tmp ufs rw 2 2
proc /proc procfs rw 0 0

In this case, the quota_partition is /. The quota partition should be the partition that holds your users. Generally, this will be one of /home, / or /usr.

Once the repquota program is returning a normal value, then you can run the tally to get the correct usage to show up in DirectAdmin:

echo “action=tally&value=all” >> /usr/local/directadmin/data/task.queue

 

Updating Apache to the latest version on DirectAdmin

Posted by nakuls77 on January 22, 2012
Posted in: Direct Admin. Leave a Comment

You can check the current version of apache by running
httpd -v

If you wish to update your 1.3 version of apache to the most recent, run the following:
cd /usr/local/directadmin/customapache
./build clean
./build update
./build apache_mod_ssl

If you’re using apache 2.x, use “./build apache_2″ isntead of apache_mod_ssl.
This should update both the configure options and the version of apache to the most recent version. Once the update has completed, you’ll need to restart apache:

RedHat:
/sbin/service httpd restart

FreeBSD:
/usr/local/etc/rc.d/httpd restart

Posts navigation

← Older Entries
  • Recent Posts

    • Install TeamSpeak Server
    • Hide BIND version
    • How to add Frame Forwarding to your website
    • How to Email Account Configuration [Microsoft Outlook 2003]
    • How to ROBOTS.TXT File Use
    • How to use SSH
    • Partition /var is Full [DirectAdmin]
    • Spamassassin : Can’t locate HTML/Parser.pm in @INC
    • Disk Usage is showing 0.00 [DirectAdmin]
    • Updating Apache to the latest version on DirectAdmin
  • Meta

    • Register
    • Log in
    • Entries RSS
    • Comments RSS
    • WordPress.com
Blog at WordPress.com. Theme: Parament by Automattic.
Follow

Get every new post delivered to your Inbox.

Powered by WordPress.com