Logo Background RSS
  • Common SSH Commands
    By on September 17th, 2008 | 3 Comments3 Comments Comments

    This is a list of Common commands that can be run from root / SSH access.

    I. Basic Commands

    A. Retrieve Plesk Admin Password

    cat /etc/psa/.psa.shadow

    B. Change Directory (cd)

    cd /path/to/directory/

    C. Listing Files/SubFolders (ls)

    ls -alh

    (files and subfolders listed with perms in human-readable sizes)

    D. Checking Processes

    ps -a top -c

    (process viewer – Ctrl+C to exit)

    ps -auxf

    (process list)

    E. Start/Stop Services

    /etc/init.d/<service> start|stop|restart|status

    (“/etc/init.d/httpd stop” stops apache)

    F. Check Bean Counters (hard and soft limits, failcounts, etc.)

    cat /proc/user_beancounters

    II. File System Commands (df & du are (dv)-only commands)

    A. Check Total Disk Usage

    df

    (gives physical disk usage report with % used)

    B. List Files/Folders +Sizes (du)

    du

    (lists all filesizes. This will take some time.)

    du -sh

    (lists all the subfolders/sizes in a dir)

    C. Remove/Delete Files (rm /path/to/filename.htm) -DANGER- always verify

    rm -vf

    (force-deletes file. Dont run unless you know EXACTLY what you’re doing)

    rm -vrf

    (force deletes folder and all subfolders and files)

    To Remove a Directory you can use the following command:

     rmdir  

    D. Copy Files (cp)

    cp filename.abc /new/path/filename.abc.123
    

    E. Move Files (mv)

    mv filename.abc /new/path/filename.abc.123
    

    F. Create Empty File (touch)

    touch filename.123

    III. File Permissions and Ownership

    A. Change Permissions of files (chmod)

    chmod 000 filename.abc

    (defaults are usually 755 for folders, 644 for files)

    TIP:

    1st digit=Owner; 2nd=Group; 3rd=Other
    (-rwxrwxwrx = 777, -rwxr-xr-x = 755, -rw-r–r– = 644, etc.)
    7 = Read + Write + Execute
    6 = Read + Write
    5 = Read + Execute
    4 = Read
    3 = Write + Execute
    2 = Write
    1 = Execute
    0 = All access denied

    B. Change Ownership of files (chmown)

    chown user:group filename.abc

    (you can see user and group w/ ls -alh)

    TIP:

    Anytime a user creates a file, the Ownership of the file matches that user. In Plesk, every domain that has hosting has a different user. So if you are copying files from one domain to another, you must remember to change ownership.

    IV. Checking Log Files (dv)

    Log files can tell you a lot about whats going on on a (dv). You can use the command:
    ‘tail -n 100′ before the logfile name to list the last 100 entries of the logfile.

    Here are some of the most common:

    A. Main Error Log

    /var/log/messages

    B. Apache Error Log

    /var/log/httpd/error_log

    (main)

    /home/httpd/vhosts/mt-example.com/statistics/logs/error_log

    (per-domain) (May also be: /var/www/vhosts on newer dvs)

    C. MySQL Logs

    /var/log/MySQLd.log
    

    D. Mail Logs

    /usr/local/psa/var/log/maillog

    NOTE:

    Common issues to look out for in log files

    • The main error log will not always give you all the information you want for a svc.
    • You may see alot of failed SSH and FTP connections, that is generally normal.
    • Keep an eye out for MaxClients errors in the Apache logs if a customer is complaining of Apache dying alot. You can check the KB for raising MaxClients settings.
    • If a customer does not set up Log Rotation for a domain under Plesk, then Log Files will build up and may take up alot of unneeded space. You can usually delete old log files in Plesk, and change the Log Rotation to Daily instead of by size.
    • MailLogs can show you if a customer is spamming, or if mail is coming in or out.
    • MySQL Logs should be able to show you general MySQL errors such as bad connections, or corrupted tables. Check the Int. KB for the ‘myisamchk -r’ repair table command.

    V. Advanced Commands

    A. Find. You can do alot with find. for now lets find all files over 10MB.

    cd /
    find / -type f -size +10000k -exec ls -lh {} \; | awk '{ print $5 ": " $9 }' |sort -n
    

    B. Grep. Another handy tool to get specific information

    cat file | grep blah

    (only lists the information where the word blah is found)

    C. Less/More

    less filename.abc 

    (displays the content of a file. arrows to scroll, ‘q’ to quit.)

    more == same thing basically. You can use the ‘| more’ command to scroll through something page or line at a time.

    tail -n 1000 /var/log/httpd/error_log | more

    VI. Vi is a basic text editor.

    Careful what keys you hit while in vi.

    vi /path/to/filename.abc

    TIP:

    You can learn more about using the VI/VIM text editor by reading the following guide:

  • Understanding basic vi (visual editor)
    By on September 16th, 2008 | 2 Comments2 Comments Comments

    vi (visual editor) is included with all (mt) Media Temple services. vi is a full screen editor and has two modes of operation.

    • Command Mode – every character entered is a command.  This is the default mode when you start vi.
    • Insert Mode – this mode allows you to edit. To enter insert mode simply hit i once vi has started.

    NOTE:

    vi is case-sensitive. Be sure to not mix uppercase and lowercase letters when running commands, as the result will not be the same.

    The best way to learn about vi is with the vimtutor, you can start your lesson by typing the following command via ssh:

    vimtutor

    Below is just a short list of a few commands that are very useful for beginners.

    Opening a File in Vi

    This first line is just to simply open a file with vi:

     vi filename

    The following command is used to recover a file that was being edited when the system crashed:

    vi -r filename

    The next command will open a file as read-only:

    vi ew filename 

    To Find a LIne in vi

    You can use the following to go to the last line in the file:

    G

    To go the the first line of the file you can use the following:

    1G 

    To move around in the editor

    • type h to type move the cursor to the left
    • type l to move it to the right
    • type k to move up
    • type j to move down

    To search within VI

    To search for text in vi you can use the “/” key followed by your search term.  This example uses mttext:

    / mttext

    To Exit vi

    To quit and not save changes you can use:

    :q!

    If you want to quit and save changes you can use the following command:

     :x !

    TIP:

    The above examples only hint at the power of vi.  It is very popular amongst developers/administrators for good reason.  We strongly suggest making backups of any files before experimenting with vi, in case you need to revert your changes.

  • Zone transfer AXFR + Change or Disable Name Server version
    By on September 5th, 2008 | 5 Comments5 Comments Comments

    At least one of your nameservers allowed a zone transfer to be performed. The zone transfer enables the extraction of all DNS data available for the zone. According to DNS best practices it is advisable to disable zone transfers for public slave zones.

    To disable zone transfer

    Login with root

    edit named.conf

    root@server [~]# vi /etc/named.conf

    by setting this in options {}

    allow-transfer { };

    root@server [~]# :wq

    axfr-ns

    Those persons who want to change there or disable thier nameserver Version do as writen in the above image.

    version  ” ” ;

    This will disable your name server Version

    That’s it you are done..

  • The Last Google Algorithm Update (August 2008)
    By on August 20th, 2008 | 1 Comment1 Comment Comments

    Hello guys,

    Today I am going to tell you about The Last Google Algorithm Update (August 2008), It seems like the last update was a nightmare for me, all my keywords dropped. I am still working hard to see if I can get them back. Anyways here is what I complied after researching a lot on the internet

    1) Link Popularity
    Now if you want to get top rankings you will have to focus on inbound links in order to see your website on google’s top #10

    2) Domain Age
    This is really a nightmare for me now! my website is a month old and is no where to be seen on google! Happened with almost all my friends with new domain. We used to see new websites ranking high if they have good content but using good content also I was not able to rank high! Now it all depends on the age of the domain!!

    3) Page Rank
    Now PageRank will be a factor for ranking high! If you have good PR you rank High

    Please note these points which I have listed are not of my own! These may also be wrong.. but I have experienced it myself so I am letting you guys know about it. Now I’m really depressed if that’s Google’s new Algorithm due to this new websites will be no where to be seen!

    PS: I just see I got few of my keywords back! blah blah

    The Last Google Algorithm Update (August 2008)

  • Why Websites Get De-indexed By Search Engines
    By on August 12th, 2008 | 2 Comments2 Comments Comments

    Today I’m gonna show you why websites get de-indexed by search engines and ways to prevent your website getting de-indexed. Recently one of my friend was working very hard on his website but suddenly he saw he have 0 indexed pages in google. He buzzed me off on IM and I thought of making this post.

    Most common reason Why Websites Get De-indexed By Search Engines are:

    Downtime – If you have a bad webhost, Its time to leave them! If your website stay offline when bots crawl it you might get de-indexed!

    Your webs was hacked – Investiage by checking server logs if your website was hacked. Also check if your post or anything on your blog has been edited. This is one most common reason for getting de-indexed.

    Robots.txt – If you recently uploaded the robots.txt file. Make sure you’re not blocking the bots.

    .htaccess – If you recently changed contents of your htaccess it might be another reason for getting de-indexed.

    Black Hat Techniques – If you have used any Black Hat Technique to increase your backlinks or SEO your blog. STOP it! Its probably the one getting you in trouble.

    Inactive Website – One most common issue is no content posted on the blog! Update your blog and wait for results!

    I got de-indexed. What to do now?

    Stay calm, no need to panic or pay someone to help you get out of the problem. The problem may increase!

    Follow these steps to get out of the situation

    Register with Google Webmaster Tools and Fix all the problems it state.

    Browse your website as Google Bot and see if you’re able to see all the contents properly

    Run Xmenu on your website and check for any external link

    Change your webhost if it remains down mostly.

    Build as many quality backlinks you can make. This will surely help you coming back to normal ..

  • Difference between Pagerank 0 and N/A
    By on August 3rd, 2008 | 1 Comment1 Comment Comments

    Hello guys

    I have seen a lot of guys confused about the Difference between Pagerank 0 and N/A! So I deciced to make a post on it.

    So what does Pagerank 0 exactly mean?

    Pagerank 0 means google has assigned pagerank to the website but due to less quality of backlinks its been given a pagerank 0.

    I’m stuck on Pagerank 0 what to do?

    This is another question I came across, Basically what you have to do to get a good pagerank is build more and more quality backlinks. If you need more information on Link Building read my blog .

    I’m stuck at Pagerank N/A what to do?

    In most of the cases when you have pagerank N/A it means that your blog is very new(Less than 3 months). Again, to get a good pagerank you will also have to build links to gain a good pagerank.

    All the best to everyone… thats all for today on topic Difference between Pagerank 0 and N/A