10 mental blocks keeping you from being a kick-ass sysadmin

Ok, it’s actually an article about 10 Mental Blocks to Creative Thinking but isn’t creative thinking a huge part of being a kick-ass sysadmin? Here’s what I thought of when I read each point, but I highly recommend that you read the whole article and look for ways it applies to you.

In terms of what mindset you should be in:

  1. There is almost always more than one right answer.
  2. Don’t be so rigid with your logic that you become blind to other possibilities.
  3. Always question everything – “why” or “why not”.
  4. Always ask “what if” and explore ideas even if they don’t seem feasible on the surface.
  5. Make time to play. You’ll be amazed at what problems you solve when you’re not at your desk.
  6. Never say “That’s not part of my job” and explore and learn about as much as you can.
  7. Try to think about things differently than everyone else at the table is.
  8. There is no black and white, only gray, and that’s ok.
  9. It’s ok to be wrong and you will be. It’s ok to make mistakes and you will. Learn from it.
  10. If you think you can’t do it, then you can’t. You won’t really know unless you try.

Repairing MySQL tables that will not open.

This should be handled on a case by case basis, but if you are using the default MySQL table type of MyISAM (which is the default storage engine unless changed or specified differently) here are a few options:

  1. The myisamchk utility can be run from a command line to checks, repairs, or optimizes tables. It is normally run while the database is not running. For more information about myisamchk visit the MySQL website.
  2. mysqlcheck is similar in function to myisamchk, but can be run while the database is running. For more information about
    mysqlcheck visit the MySQL website.
  3. If you login to the database, you can also run sql commands that might fix your problem.
    Examples:
    mysql> optimize table your-tablename;
    mysql> analyze table your-tablename;
    mysql> repair table your-tablename;

    For more information about
    table maintenance SQL visit the MySQL website.
  4. If you are getting MySQL error numbers and are not sure what they are. From a command line you can use the perror utility to lookup errors. For more info on perror visit the MySQL website.
    Examples:
    shell> perror 13 64
    Error code 13: Permission denied
    Error code 64: Machine is not on the network

Cannot install binary packages using pkg_addCannot install binary packages using pkg_add

Failure to install binary packages in older FreeBSD versions using “pkg_add -r”.


Solution:

Add these lines to /etc/csh.cshrc (/etc/profile if you are using bash or sh):

[FreeBSD 4.x]
setenv PACKAGESITE ftp://ftp.freebsd.org/pub/FreeBSD/ports/i386/packages-4-stable/Latest/
setenv PACKAGELIST

[FreeBSD 5.x]
setenv PACKAGESITE ftp://ftp.freebsd.org/pub/FreeBSD/ports/i386/packages-5-stable/Latest/
setenv PACKAGELIST

Need to change IP address in FreeBSD

Issue: A change of IP address is needed in FreeBSD.

Solution: If you do not have the root password boot into Single User mode [option 4]. Procced to step 1.

If you have the root password procced to step 2.

1. mount -o (if you get a read-only error, you will have to run fschk -y)

2. vi /etc/rc.conf (If vi is unavailable use ee)

at this point simply edit the IP Address lines that will need to be corrected.

How to bind IPs on a Windows Server

1. Start -> Settings -> Control Panel -> Network Connections
2. Right click and go to properties of the enabled/active NIC
3. Highlight on TCP/IP and click on properties
4. Select ” Use the following IP address ”
5. Enter your IP information for the server.
6. Click on Advanced
7. Click Add on the IP Settings tab.
8. Enter the usable IP range along with the netmask. ( ie 255.255.255.0 )
9. Click OK.

How to block ip addresses with iptables

I have an ip address attacking my server or taking up all my httpd connections so none of my sites work.

In order to correct this you will want to use the netstat -n command to see the ip addresses connected to your server. Once you have the ip address you want to block you can use the following command to block them from accessing your server using iptables

iptables -I INPUT 1 -s IP.ADD.RES.SS -j DROP

-I INPUT 1 means to insert the rule at the top of the INPUT table (which means it will get looked at first)

-s IP.ADD.RES.SS is the source address of the packets we want to deal with

-j DROP means dump the packets into the void, and forget they ever happened.

How to forward a website to another url using PHP

There are several ways to accomplish this task, but the simplest to understand is to use php.

To do this, you need to create the page that will do the forwarding. This can be any page, as long as it ends in “.php”. If you are trying to redirect a domain, you’d create “index.php” inside the public_html directory.

Once you decide which page you will use, then create the file and enter the following text:

<?php
header(“Location: http://whereyouwant.com/to/go.html“);
?>

Where http://whereyouwant.com/to/go.html is the location that you want the page to forward to. You can use local values, ie: /page.html, or full urls as in the above example (http://..etc.)