<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>UnixNewbie.org &#187; Server Admin Tips</title>
	<atom:link href="http://www.unixnewbie.org/category/server-admin-tips/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.unixnewbie.org</link>
	<description></description>
	<lastBuildDate>Mon, 30 Nov 2009 16:58:16 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Iptables cheat sheet</title>
		<link>http://www.unixnewbie.org/iptables-cheat-sheet/</link>
		<comments>http://www.unixnewbie.org/iptables-cheat-sheet/#comments</comments>
		<pubDate>Tue, 17 Nov 2009 16:39:50 +0000</pubDate>
		<dc:creator>Stephen</dc:creator>
				<category><![CDATA[Cheat Sheets]]></category>

		<guid isPermaLink="false">http://www.unixnewbie.org/?p=1139</guid>
		<description><![CDATA[Iptables is a Linux kernel-level module allowing us to perform various networking manipulations (i.e. packet filtering) to achieve better network security...]]></description>
			<content:encoded><![CDATA[<p>Iptables is a Linux kernel-level module allowing us to perform various networking manipulations (i.e. packet filtering) to achieve better network security.</p>
<p>Here are some iptables commands I have found useful.  This list will be updated from time to time.</p>
<p><strong>View all current iptables rules:</strong></p>
<pre>iptables -L -v</pre>
<p>&nbsp;</p>
<p><strong>View all INPUT rules:</strong></p>
<pre>iptables -L INPUT -nv</pre>
<p>&nbsp;</p>
<p><strong>How to block an IP address using iptables:</strong></p>
<pre>iptables -I INPUT -s "201.128.33.200" -j DROP</pre>
<p>&nbsp;</p>
<p><strong>To block a range of IP addresses:</strong></p>
<pre>iptables -I INPUT -s "201.128.33.0/24" -j DROP</pre>
<p>&nbsp;</p>
<p><strong>How to unblock an IP address:</strong></p>
<pre>iptables -D INPUT -s "201.128.33.200" -j DROP</pre>
<p>&nbsp;</p>
<p><strong>How to block all connections to a port:</strong><br />
To block port 25:</p>
<pre>iptables -A INPUT -p tcp --dport 25 -j DROP
iptables -A INPUT -p udp --dport 25 -j DROP</pre>
<p>&nbsp;</p>
<p><strong>How to un-block:</strong><br />
To enable port 25:</p>
<pre>iptables -A INPUT -p tcp --dport 25 -j ACCEPT
iptables -A INPUT -p udp --dport 25 -j ACCEPT </pre>
<p>&nbsp;</p>
<p><strong>To save all rules so that they are not lost in case of a server reboot:</strong></p>
<pre>/etc/init.d/iptables save</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.unixnewbie.org/iptables-cheat-sheet/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Exim Cheatsheet</title>
		<link>http://www.unixnewbie.org/exim-cheatsheet/</link>
		<comments>http://www.unixnewbie.org/exim-cheatsheet/#comments</comments>
		<pubDate>Mon, 09 Nov 2009 18:31:23 +0000</pubDate>
		<dc:creator>Stephen</dc:creator>
				<category><![CDATA[Cheat Sheets]]></category>
		<category><![CDATA[Server Admin Tips]]></category>

		<guid isPermaLink="false">http://www.unixnewbie.org/?p=920</guid>
		<description><![CDATA[Exim is the widely used open source mail transfer agent. It is responsible for routing, delivering, and receiving email messages.]]></description>
			<content:encoded><![CDATA[<p>Exim is the widely used open source mail transfer agent.  It is responsible for routing, delivering, and receiving email messages.  Here are some of my favorite, <strong>useful exim commands via shell</strong>.</p>
<p>&nbsp;</p>
<p>This command will show exim processes including the path to the script being utilized to send mail. Very useful in locating a spamming script:</p>
<pre>ps -C exim -fH eww</pre>
<p>&nbsp;<br />
<br />
This will show the route of the email address.  It is useful when you try to diagnose email delivery problems:</p>
<pre>exim -bt user@domain.com</pre>
<p>&nbsp;<br />
<br />
To perform a SMTP testing session as if the mail comes from a particular host for testing filtering rules inside your server:</p>
<pre>exim -bh ipaddresshere</pre>
<p>&nbsp;<br />
<br />
This will show what exim is currently doing:</p>
<pre>exiwhat</pre>
<p>&nbsp;<br />
<br />
Mail server queue:</p>
<pre>exim -bpc &nbsp; // print the total number of emails currently in server queue.
exim -bp &nbsp; // print mails in queue sorting by time, size,...
exim -bp | exiqsumm &nbsp; // count, volume, oldest, newest, domain, and totals
</pre>
<p>&nbsp;<br />
<br />
To list exim&#8217;s configuration setting:</p>
<pre>exim -bP</pre>
<p>&nbsp;<br />
<br />
To start a queue run:</p>
<pre>exim -q -v</pre>
<p>&nbsp;<br />
<br />
To start a queue run for just local deliveries:</p>
<pre> exim -ql -v</pre>
<p>&nbsp;<br />
<br />
To remove a message from the queue:</p>
<pre>exim -Mrm &lt;message-id&gt;</pre>
<p>&nbsp;<br />
<br />
To freeze a message:</p>
<pre>exim -Mf &lt;message-id&gt;</pre>
<p>&nbsp;<br />
<br />
To force delivery of a message:</p>
<pre>exim -M &lt;message-id&gt;</pre>
<p>&nbsp;<br />
<br />
To remove all frozen messages:</p>
<pre>exiqgrep -z -i | xargs exim -Mrm</pre>
<p>&nbsp;<br />
<br />
To remove all messages older than 1 day (the number is in seconds):</p>
<pre>exiqgrep -o 86400 -i | xargs exim -Mrm</pre>
<p>&nbsp;<br />
<br />
To freeze all queued mail from a given sender:</p>
<pre>exiqgrep -i -f user@domain.com | xargs exim -Mf</pre>
<p>&nbsp;<br />
<br />
Message viewing:</p>
<pre>exim -Mvh &lt;message-id&gt;  &nbsp; // view message's headers
exim -Mvb &lt;message-id&gt;  &nbsp; // view message's body
exim -Mvl &lt;message-id&gt;  &nbsp; // view message's logs</pre>
<p>&nbsp;<br />
</p>
<h2>Exiqgrep</h2>
<p>At times, we will be required to search the mail queue for a particular message to help troubleshooting mail problems for our users.  Here are some useful <a href="http://www.exim.org/exim-html-4.50/doc/html/spec_49.html#IX2895" target=_blank>exiqgrep</a> commands.</p>
<p>&nbsp;<br />
This will search the queue for messages coming from a specific sender:</p>
<pre>exiqgrep -f user@domain.com</pre>
<p>&nbsp;<br />
<br />
This will search the queue for messages from a specific recipient:</p>
<pre>exiqgrep -r user@domain.com</pre>
<p>&nbsp;<br />
<br />
This will display messages older than the specified number of seconds. </p>
<pre>exiqgrep -o 86400  &nbsp; // more than a day old</pre>
<p>&nbsp;<br />
<br />
This will display messages newer than the specified number of seconds. </p>
<pre>exiqgrep -y 3600  &nbsp; // less than an hour old</pre>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.unixnewbie.org/exim-cheatsheet/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Ubuntu LAMP cheat sheet</title>
		<link>http://www.unixnewbie.org/ubuntu-lamp-cheat-sheet/</link>
		<comments>http://www.unixnewbie.org/ubuntu-lamp-cheat-sheet/#comments</comments>
		<pubDate>Mon, 09 Nov 2009 14:45:34 +0000</pubDate>
		<dc:creator>Stephen</dc:creator>
				<category><![CDATA[Cheat Sheets]]></category>
		<category><![CDATA[Ubuntu]]></category>

		<guid isPermaLink="false">http://www.unixnewbie.org/?p=990</guid>
		<description><![CDATA[LAMP: the server software bundle consists of Linux - Apache - MySQL - PHP; Linux: operating system; Apache: http server; MySQL: database software; PHP: scripting language]]></description>
			<content:encoded><![CDATA[<p>LAMP: the server software bundle consists of Linux &#8211; Apache &#8211; MySQL &#8211; PHP; Linux: operating system; Apache: http server; MySQL: database software; PHP: scripting language</p>
<p>&nbsp;</p>
<h2>Location, configuration file:</h2>
<p>&nbsp;<br />
<strong>Apache configuration file:</strong></p>
<pre>/etc/apache2/apache2.conf</pre>
<p>&nbsp;<br />
<strong>PHP php.ini file:</strong></p>
<pre>/etc/php5/apache2/php.ini</pre>
<p>&nbsp;<br />
<strong>MySQL configuration file:</strong></p>
<pre>/etc/mysql/my.cnf</pre>
<p>&nbsp;<br />
<strong>Default (initial) web location:</strong></p>
<pre>/var/www</pre>
<p>&nbsp;<br />
<strong>Web browser address:</strong></p>
<pre>http://localhost/</pre>
<p>&nbsp;</p>
<h2>Restarting:</h2>
<p>&nbsp;<br />
<strong>How to restart apache:</strong></p>
<pre>sudo /etc/init.d/apache2 restart</pre>
<p>&nbsp;<br />
<strong>How to restart MySQL:</strong></p>
<pre>sudo /etc/init.d/mysql restart</pre>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.unixnewbie.org/ubuntu-lamp-cheat-sheet/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Unix FIND command cheat sheet</title>
		<link>http://www.unixnewbie.org/unix-find-command-cheat-sheet/</link>
		<comments>http://www.unixnewbie.org/unix-find-command-cheat-sheet/#comments</comments>
		<pubDate>Sun, 08 Nov 2009 22:56:45 +0000</pubDate>
		<dc:creator>Stephen</dc:creator>
				<category><![CDATA[Cheat Sheets]]></category>
		<category><![CDATA[Server Admin Tips]]></category>

		<guid isPermaLink="false">http://www.unixnewbie.org/?p=968</guid>
		<description><![CDATA["find" is a Unix command allowing us to search for files within our Unix/Linux operating system.  "find" can search for files based on name, type, size, modified date, etc...  I often use "find" to locate bad files within a hacked system/account.  ]]></description>
			<content:encoded><![CDATA[<p>&#8220;find&#8221; is a Unix command allowing us to search for files within our Unix/Linux operating system.  &#8220;find&#8221; can search for files based on name, type, size, modified date, etc&#8230;  I often use &#8220;find&#8221; to locate bad files within a hacked system/account.  </p>
<p>&nbsp;<br />
<br />&nbsp;<br />
<strong>To search for files by name:</strong></p>
<pre>find dir -name keyword</pre>
<p>dir: directory you want to search for files<br />
keyword: the name of the file you want to search for<br />
<u>examples: </u><br />
<em>find /home/test -name &#8220;index.txt&#8221;</em><br />
<em>find /home -name &#8220;shell*&#8221;</em>  &nbsp; // find files beginging with &#8220;shell&#8221;</p>
<p>&nbsp;<br />
<strong>To search for files by modified date:</strong><br />
<br />
<u>by the minute:</u></p>
<pre>find dir -mmin time</pre>
<p>&nbsp;<br />
<u>by the hour:</u></p>
<pre>find dir -mtime time</pre>
<p>&nbsp;<br />
<u>examples:</u><br />
<em>find /home -mmin -30</em>  &nbsp; // find all files modified in the past 30 minutes<br />
<em>find /home -mmin +30</em>  &nbsp; // find all files modified more than 30 minutes ago<br />
<em>find /home -mmin +30 -mmin -60</em>  &nbsp; // find all files modified between 30 and 60 minutes ago<br />
<em>find /home -mtime -1</em> &nbsp; // find all files modified within the past 1-day (24 hours)<br />
<em>find /home -mtime -7</em> &nbsp; // find all files modified within the past 1-week (7 days)</p>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.unixnewbie.org/unix-find-command-cheat-sheet/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>RPM cheat sheet</title>
		<link>http://www.unixnewbie.org/rpm-cheat-sheet/</link>
		<comments>http://www.unixnewbie.org/rpm-cheat-sheet/#comments</comments>
		<pubDate>Fri, 06 Nov 2009 19:47:36 +0000</pubDate>
		<dc:creator>Stephen</dc:creator>
				<category><![CDATA[Cheat Sheets]]></category>
		<category><![CDATA[Server Admin Tips]]></category>

		<guid isPermaLink="false">http://www.unixnewbie.org/?p=926</guid>
		<description><![CDATA[RPM cheat sheet]]></description>
			<content:encoded><![CDATA[<p>RPM is the package manager for the following Linux Operating Systems: RedHat, CentOS, Fedora and SUSE.  Here, I noted down some useful commands to manage RPM packages.  Please share if you know other useful RPM commands.</p>
<p>&nbsp;<br />
<br />&nbsp;<br />
<strong>Install a package:</strong></p>
<pre>rpm -ivh package_name</pre>
<p>&nbsp;<br />
<strong>Upgrade a package:</strong></p>
<pre>rpm -Uvh package_name</pre>
<p>&nbsp;<br />
<strong>Uninstall a package:</strong></p>
<pre>rpm -ev package_name</pre>
<p>&nbsp;<br />
<strong>Uninstall a package without checking for its dependencies:</strong></p>
<pre>rpm -ev --nodeps package_name</pre>
<p>&nbsp;<br />
<strong>Display the version of the installed package:</strong></p>
<pre>rpm -q package_name</pre>
<p>&nbsp;<br />
<strong>Display the name and version of all packages installed in the server:</strong></p>
<pre>rpm -qa</pre>
<p>&nbsp;<br />
<strong>Display the packages got installed recently:</strong></p>
<pre>rpm -qa --last</pre>
<p>&nbsp;<br />
<strong>To rebuild a corrupted RMP database:</strong></p>
<pre>rpm --rebuilddb</pre>
<p>&nbsp;</p>
]]></content:encoded>
			<wfw:commentRss>http://www.unixnewbie.org/rpm-cheat-sheet/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Screen cheat sheet</title>
		<link>http://www.unixnewbie.org/screen-cheat-sheet/</link>
		<comments>http://www.unixnewbie.org/screen-cheat-sheet/#comments</comments>
		<pubDate>Fri, 06 Nov 2009 16:45:04 +0000</pubDate>
		<dc:creator>Stephen</dc:creator>
				<category><![CDATA[Cheat Sheets]]></category>
		<category><![CDATA[Server Admin Tips]]></category>

		<guid isPermaLink="false">http://www.unixnewbie.org/?p=913</guid>
		<description><![CDATA[Have you ever experienced a problem where your remote shell session got killed (for various reasons) in the middle of your crucial software compilations?  Well it has happened to me several times ranging from getting killed in the middle of php compilations, easyapache, kernel :oops:, to a new cPanel installation 8O.  Most of the time, it was due to bad internet connection.  To combat with this, a friend suggested me a solution: to use Screen.]]></description>
			<content:encoded><![CDATA[<p>Have you ever experienced a problem where your remote shell session got killed (for various reasons) in the middle of your crucial software compilations?  Well it has happened to me several times ranging from getting killed in the middle of php compilations, easyapache, kernel <img src='http://www.unixnewbie.org/wp-includes/images/smilies/icon_redface.gif' alt=':oops:' class='wp-smiley' /> , to a new cPanel installation 8O.  Most of the time, it was due to bad internet connection.  To combat with this, a friend suggested me a solution: to use Screen.</p>
<p>&nbsp;<br />
<strong>What is Screen?</strong><br />
Screen is a free Unix software.  Under Screen, if your shell session gets disconnected, the screen session doesn&#8217;t go away.  It will continue the compilations until completion.  Sounds good <img src='http://www.unixnewbie.org/wp-includes/images/smilies/icon_lol.gif' alt=':lol:' class='wp-smiley' /> </p>
<p>&nbsp;<br />
<strong>How to install screen under CentOS?</strong></p>
<pre>yum install screen</pre>
<p>&nbsp;<br />
<strong>How to use Screen?</strong> Simply type:</p>
<pre>screen</pre>
<p>then you will be led into a new virtual shell terminal.  After that, just work with your commands normally.</p>
<p>&nbsp;<br />
<strong>If my session got disconnected, how do I resume my Screen session?</strong></p>
<pre>screen -r</pre>
<p>&nbsp;<br />
<strong>If I have multiple screen sessions, how do I see them?</strong></p>
<pre>screen -list</pre>
<p>&nbsp;<br />
<strong>How to exit Screen?</strong></p>
<pre>exit</pre>
<p>&nbsp;<br />
<strong>How do I exit Screen but still leaving my compilations to keep on compiling?</strong></p>
<pre>ctrl+a+d</pre>
<p>You will then led back to your original shell session.  Your screen session will keep on working.  To resume, you can use &#8220;screen -r&#8221;.  Pretty useful right?</p>
]]></content:encoded>
			<wfw:commentRss>http://www.unixnewbie.org/screen-cheat-sheet/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Useful MySQL shell commands</title>
		<link>http://www.unixnewbie.org/useful-mysql-shell-commands/</link>
		<comments>http://www.unixnewbie.org/useful-mysql-shell-commands/#comments</comments>
		<pubDate>Thu, 05 Nov 2009 05:24:20 +0000</pubDate>
		<dc:creator>Stephen</dc:creator>
				<category><![CDATA[MySQL]]></category>
		<category><![CDATA[Server Admin Tips]]></category>

		<guid isPermaLink="false">http://www.unixnewbie.org/?p=876</guid>
		<description><![CDATA[<img src="http://unixnewbie.org/images/mysql.png" align=left hspace="10"> MySQL cheat sheet. In this post, I collected the most useful MySQL commands via shell.  I will keep expanding as time goes.
<br />&#160;]]></description>
			<content:encoded><![CDATA[<p>We rarely have to use MySQL via command line but if you happen to, here are some basic but useful MySQL commands.</p>
<p>&nbsp;<br />
<br />&nbsp;</p>
<h3>How to login to MySQL:</h3>
<pre>mysql -u root -p</pre>
<p>&nbsp;</p>
<h3>How to create a MySQL database via Shell:</h3>
<p>After you logged in, execute this command (replace <span style="color: #3366ff;">dbname</span> with the name of the database you want to create):</p>
<pre>mysql> create database <span style="color: #3366ff;">dbname</span>;

Output:
Query OK, 1 row affected (0.01 sec)</pre>
<p>&nbsp;</p>
<h3>How to delete a MySQL database via Shell:</h3>
<pre>mysql> drop database <span style="color: #3366ff;">dbname</span>;

Output:
Query OK, 0 rows affected (0.05 sec)</pre>
<p>&nbsp;</p>
<h3>How to create a MySQL User via Shell:</h3>
<p>(replace <span style="color: #3366ff;">dbusername</span> with the username you want to create)</p>
<pre>mysql> create user <span style="color: #3366ff;">dbusername</span>;</pre>
<p>&nbsp;</p>
<h3>How to set a password for the MySQL User you just created:</h3>
<p>(replace <span style="color: #3366ff;">passhere</span> with the password you would like to set)</p>
<pre>mysql> set password for dbusername = password('<span style="color: #3366ff;">passhere</span>');</pre>
<p>&nbsp;</p>
<h3>How to grant privileges for the username to the database:</h3>
<pre>mysql> grant all privileges on <span style="color: #3366ff;">dbname</span>.* to <span style="color: #3366ff;">dbusername</span>@localhost identified by '<span style="color: #3366ff;">passhere</span>';</pre>
<p>&nbsp;</p>
<h3>How to display database tables in a MySQL database?</h3>
<p>&nbsp;<br />
<strong>First enter the database by executing:</strong></p>
<pre>mysql> use <span style="color: #3366ff;">dbname</span>;</pre>
<p>&nbsp;<br />
<strong>Now show tables:</strong></p>
<pre>mysql> show tables; </pre>
<p>&nbsp;<br />
<strong>To search for a specific table without remembering its exact name:</strong><br />
(where <strong>keyword</strong> is the partial name you remember)</p>
<pre>mysql> show tables in dbname like '%<span style="color: #3366ff;">keyword</span>'; </pre>
<p>&nbsp;</p>
<h3>How to exit MySQL via Shell:</h3>
<pre>mysql> exit</pre>
]]></content:encoded>
			<wfw:commentRss>http://www.unixnewbie.org/useful-mysql-shell-commands/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Useful Yum Commands</title>
		<link>http://www.unixnewbie.org/useful-yum-commands/</link>
		<comments>http://www.unixnewbie.org/useful-yum-commands/#comments</comments>
		<pubDate>Mon, 26 Oct 2009 21:26:57 +0000</pubDate>
		<dc:creator>Stephen</dc:creator>
				<category><![CDATA[CentOS]]></category>
		<category><![CDATA[Server Admin Tips]]></category>

		<guid isPermaLink="false">http://www.unixnewbie.org/?p=587</guid>
		<description><![CDATA[Here are some very useful Yum commands.
<span style="color: #008080;">yum install &#60;package name&#62;</span>
<em>This allows you to install the latest version of a package. Yum will automatically install all dependencies.</em>]]></description>
			<content:encoded><![CDATA[<p><strong>Here are some very useful Yum commands:</strong></p>
<ol>
<li><span style="color: #008080;">yum check-update</span><br />
<em>This allows you to check to see if there is any update available for your installed packages.</em><br />&nbsp;</li>
<li><span style="color: #008080;">yum update</span><br />
<em>This will update all packages to the latest version.</em><br />&nbsp;</li>
<li><span style="color: #008080;">yum update &lt;package name&gt;</span><br />
<em>Use this to just update one package at a time.</em><br />&nbsp;</li>
<li><span style="color: #008080;">yum search &lt;keyword&gt;</span><br />
<em>You can use this command to search for any packages containing specific keyword. Pretty useful to locate the <span style="text-decoration: underline;">full name</span> of a particular package.</em><br />&nbsp;</li>
<li><span style="color: #008080;">yum install &lt;package name&gt;</span><br />
<em>This allows you to install the latest version of a package. Yum will automatically install all dependencies.</em><br />&nbsp;</li>
<li><span style="color: #008080;">yum remove &lt;package name&gt;</span><br />
<em>Used to delete/remove a package, along with its dependencies if any.</em><br />&nbsp;</li>
<li><span style="color: #008080;">yum localinstall &lt;absolute path to package&gt;</span><br />
<em>With &#8220;yum install&#8221;, yum automatically downloads the package for you.  In case you already downloaded the package yourself, you  can use this command to install it. Make sure to state the full path to the package you downloaded.  i.e. yum localinstall /home/test.tar.gz</em><br />&nbsp;</li>
<li><span style="color: #008080;">yum info &lt;package name&gt;</span><br />
<em>Lists information about a package.</em><br />&nbsp;</li>
</ol>
<p>If you know more, please add to the list!</p>
]]></content:encoded>
			<wfw:commentRss>http://www.unixnewbie.org/useful-yum-commands/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Sysadmin Stories: Moral of these stories</title>
		<link>http://www.unixnewbie.org/ss-moral-of-these-stories/</link>
		<comments>http://www.unixnewbie.org/ss-moral-of-these-stories/#comments</comments>
		<pubDate>Mon, 19 Oct 2009 23:28:38 +0000</pubDate>
		<dc:creator>Stephen</dc:creator>
				<category><![CDATA[Sysadmin Stories]]></category>

		<guid isPermaLink="false">http://www.unixnewbie.org/?p=531</guid>
		<description><![CDATA[Moral of these sysadmin stories...]]></description>
			<content:encoded><![CDATA[<p>1</p>
<blockquote><p>From: jarocki@dvorak.amd.com (John Jarocki)<br />
Organization: Advanced Micro Devices, Inc.; Austin, Texas</p>
<p>- Never hand out directions on &#8220;how to&#8221; do some sysadmin task<br />
  until the directions have been tested thoroughly.<br />
  &#8211; Corollary:  Just because it works one one flavor<br />
    on *nix says nothing about the others. &#8216;-}<br />
  &#8211; Corollary:  This goes for changes to rc.local (and<br />
    other such &#8220;vital&#8221; scripties.</p></blockquote>
<p>2</p>
<blockquote><p>From: ericw@hobbes.amd.com (Eric Wedaa)<br />
Organization: Advanced Micro Devices, Inc.</p>
<p>-NEVER use &#8216;rm <any pattern>&#8216;, use rm -i <any pattern>&#8216; instead.<br />
-Do backups more often than you go to church.<br />
-Read the backup media at least as often as you go to church.<br />
-Set up your prompt to do a `pwd` everytime you cd.<br />
-Always do a `cd .` before doing anything.<br />
-DOCUMENT all your changes to the system (We use a text file<br />
 called /Changes)<br />
-Don&#8217;t nuke stuff you are not sure about.<br />
-Do major changes to the system on Saturday morning so you will<br />
 have all weekend to fix it.<br />
-Have a shadow watching you when you do anything major.<br />
-Don&#8217;t do systems work on a Friday afternoon. (or any other time<br />
 when you are tired and not paying attention.)</p></blockquote>
<p>3</p>
<blockquote><p>From: rca@Ingres.COM (Bob Arnold)<br />
Organization: Ask Computer Systems Inc., Ingres Division, Alameda CA 94501</p>
<p>1) The &#8220;man&#8221; pages don&#8217;t tell you everything you need to know.<br />
2) Don&#8217;t do backups to floppies.<br />
3) Test your backups to make sure they are readable.<br />
4) Handle the format program (and anything else that writes directly<br />
   to disk devices) like nitroglycerine.<br />
5) Strenuously avoid systems with inadequate backup and restore<br />
   programs wherever possible (thank goodness for &#8220;restore&#8221; with<br />
   an &#8220;e&#8221;!).<br />
6) If you&#8217;ve never done sysadmin work before, take a formal<br />
   training class.<br />
7) You get what you pay for.<br />
 <img src='http://www.unixnewbie.org/wp-includes/images/smilies/icon_cool.gif' alt='8)' class='wp-smiley' /> There&#8217;s no substutite for experience.<br />
9) It&#8217;s a lot less painful to learn from someone else&#8217;s experience<br />
   than your own (that&#8217;s what this thread is about, I guess <img src='http://www.unixnewbie.org/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' />  )</p></blockquote>
<p>4</p>
<blockquote><p>From: jimh@pacdata.uucp (Jim Harkins)<br />
Organization: Pacific Data Products</p>
<p>If you appoint someone to admin your machine you better be willing<br />
to train them.  If they&#8217;ve never had a hard disk crash on them you might want<br />
to ensure they understand hardware does stuff like that.</p></blockquote>
<p>5</p>
<blockquote><p>From: dvsc-a@minster.york.ac.uk<br />
Organization: Department of Computer Science, University of York, England</p>
<p>Beware anything recursive when logged in as root!</p></blockquote>
<p>6</p>
<blockquote><p>From: matthews@oberon.umd.edu (Mike Matthews)<br />
Organization: /etc/organization</p>
<p>*NEVER* move something important.  Copy, VERIFY, and THEN delete.</p></blockquote>
<p>7</p>
<blockquote><p>From: almquist@chopin.udel.edu (Squish)<br />
Organization: Human Interface Technology Lab (on vacation)</p>
<p>When you are doing some BIG type the command and reread what you&#8217;ve typed<br />
about 100 times to make sure its sunk in (:</p></blockquote>
<p>8</p>
<blockquote><p>From: Nick Sayer <mrapple@quack.sac.ca.us></p>
<p>If / is full, du /dev.</p></blockquote>
<p>9</p>
<blockquote><p>From: TRIEMER@EAGLE.WESLEYAN.EDU<br />
Organization: Wesleyan College</p>
<p>Never ever assume that some prepackaged script that you are running does<br />
anything right.</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://www.unixnewbie.org/ss-moral-of-these-stories/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Sysadmin Stories: Miscellaneous</title>
		<link>http://www.unixnewbie.org/sysadmin-stories-miscellaneous/</link>
		<comments>http://www.unixnewbie.org/sysadmin-stories-miscellaneous/#comments</comments>
		<pubDate>Mon, 19 Oct 2009 23:25:21 +0000</pubDate>
		<dc:creator>Stephen</dc:creator>
				<category><![CDATA[Sysadmin Stories]]></category>

		<guid isPermaLink="false">http://www.unixnewbie.org/?p=529</guid>
		<description><![CDATA[Miscellaneous sysadmin stories...]]></description>
			<content:encoded><![CDATA[<p>1</p>
<blockquote><p>From: hirai@cc.swarthmore.edu (Eiji Hirai)<br />
Organization: Information Services, Swarthmore College, Swarthmore, PA, USA</p>
<p>We were running a system software that had a serious bug where if anyone<br />
had logged out ungracefully, the system wouldn&#8217;t let any more users onto the<br />
system and users who were logged on couldn&#8217;t execute any new commands.  (The<br />
newest release of the software later on did fix this bug.) I had to reboot<br />
the machine to restore the system to a sane state.  I did a wall <<EOF We<br />
need to shutdown blah blah... EOF and then shutdown.  Well, I should've<br />
waited since at the precise moment, one of our users was doing a once-a-year<br />
massive conversion of our financial data (talk about bad luck).  I had<br />
shutdown in the middle of a very long disk write and thus, data was lost.<br />
We did recover that data and life went on.</p>
<p>Moral: make damn sure that *no one* is doing anything on your system before you<br />
reboot, even if other users are vociferously clamoring for you to reboot.</p></blockquote>
<p>2</p>
<blockquote><p>From: robjohn@ocdis01.UUCP (Contractor Bob Johnson)<br />
Organization: Tinker Air Force Base, Oklahoma</p>
<p>Management told us to email a security notice to every user on the our<br />
system (at that time, around 3000 users).  A certain novice administrator<br />
on our system wanted to do it, so I instructed them to extract a list of<br />
users from /etc/passwd, write a simple shell loop to do the job, and<br />
throw it in the background.  Here&#8217;s what they wrote (bourne shell)&#8230;</p>
<p>       for USER in `cat user.list`; do<br />
          mail $USER <message.text &#038;<br />
       done</p>
<p>Have you ever seen a load average of over 300 ???</p></blockquote>
<p>3</p>
<blockquote><p>From: Iain.Lea%anl433.uucp@Germany.EU.net (Iain Lea)<br />
Organization: ANL A433, Siemens AG., Germany.</p>
<p>I used to work at Siemens R&#038;D in Erlangen (33000 people out of 115000<br />
population work at Siemens &#8211; 12000 in the R&#038;D area).  We were working<br />
on a project porting an ISO FTAM implementation in Ada to C.</p>
<p>About 2 months into the project we received a new project leader who<br />
decided there were too few people working on the project (sigh!).<br />
Anyway we were promised that a &#8220;Spitzen Klasse&#8221; (Outstanding) SW guy<br />
was being sent over from the next lab.</p>
<p>The fateful day turned up (had to be a monday) and there was our very<br />
own &#8216;Einstein&#8217;. We gave him a tour of the lab (ie. Coffee machine on<br />
the left, laser on the right etc.) finally getting to out work area.<br />
We had a couple of fast 386&#8242;s (this happened in &#8217;89) running Xenix 386.<br />
We told Einstein that I was the sysadmin for both machines and that if<br />
*anything* was strange or not working to speak with me.  OK so the first<br />
morning went off without a hitch and we all went to get someting to eat<br />
around midday.  All except Einstein who said he wanted to check a few<br />
things out (Code practices we thought etc. &#8211; turned out to be Page 3 of<br />
that months playboy).</p>
<p>We came back from eating to find Einstein twiddling his thumbs and<br />
saying that he could no longer log in on either machine.  Ermmm&#8230;</p>
<p>I asked him if *anything* had happened while we were away.  He thought<br />
and thought and then said &#8220;Nothing really but the lights went out for<br />
a few minutes&#8221;.  OK I thought &#8220;fsck the disks, remount them and away<br />
we go&#8221; but then I stopped and asked him again &#8220;Anything else?&#8221;.  He<br />
then really started looking around and found the palms of his hand<br />
the most interesting thing he&#8217;d ever seen.  He answered &#8220;Well I know<br />
a little about Unix and fsck is the &#8216;ajax&#8217; cleaning program of Unix<br />
so when it started again after the lights came back on it started<br />
fsck and asked me for a scratchpad file.  I just took the one it<br />
printed on the line above!&#8221; (ie. the name of the filesystem to clean).</p>
<p>Another comment he made was &#8220;Must be a fast machine as fsck ran quick&#8221;.</p>
<p>Bad you might say until he told me he had done the same thing to our<br />
backup machine.</p>
<p>Needless to say Einstein &#038; our project leader exited stage left&#8230;</p>
<p>And we eventually got a backup tape from our data safe stored at<br />
another lab. The SW guy is kind of a living legend around here <img src='http://www.unixnewbie.org/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p></blockquote>
<p>4</p>
<blockquote><p>From: rca@Ingres.COM (Bob Arnold)<br />
Organization: Ask Computer Systems Inc., Ingres Division, Alameda CA 94501</p>
<p>Many moons ago, in my first sysadmin job, learning via &#8220;on-the-job<br />
training&#8221;, I was in charge of a UNIX box who&#8217;s user disk developed a<br />
bad block.  (Maybe you can see it already &#8230;)</p>
<p>The &#8220;format&#8221; man page seemed to indicate that it could repair bad<br />
blocks.  (Can you see it now?)  I read the man page very carefully.<br />
Nowhere did it indicate any kind of destructive behavior.</p>
<p>I was brave and bold, not to mention boneheaded, and formatted the user disk.<br />
Heh.</p>
<p>The good news:<br />
	1) The bad block was gone.<br />
	2) I was about to learn a lot real fast <img src='http://www.unixnewbie.org/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /><br />
The bad news:<br />
	1) The user data was gone too.<br />
	2) The users weren&#8217;t happy, to say the least.</p>
<p>Having recently made a full backup of the disk, I knew I was in for a<br />
miserable all day restore.  Why all day?  It took 8 hours to dump<br />
that disk to 40 floppies.  And I had incrementals (levels 1, 2, 3, 4,<br />
and 5, which were another sign of my novice state) to layer on top<br />
of the full.</p>
<p>Only it got worse.  The floppy drive had intermittent problems reading<br />
some of the floppies.  So I had to go back and retry to get the files<br />
which were missed on the first attempt.</p>
<p>This was also a port of Version 7 UNIX (like I said, this was many<br />
moons ago).  It had a program called &#8220;restor&#8221;, primordial ancestor of<br />
BSD&#8217;s &#8220;restore&#8221;.  If you used the &#8220;x&#8221; option to extract selected files<br />
(the ones missed on earlier attempts), &#8220;restor&#8221; would use the *inode<br />
number* as the name of the extracted files.  You had to move the<br />
extracted files to their correct locations yourself (the man page said<br />
to write a shellscript to do this <img src='http://www.unixnewbie.org/wp-includes/images/smilies/icon_sad.gif' alt=':-(' class='wp-smiley' /> ).  I didn&#8217;t know much about shell<br />
scripts at the time, but I learned a lot more that week.</p>
<p>Yes, it took me a full week, including the weekend, maybe 120 hours or<br />
more, to get what I could (probably 95% of the data) off the backups.<br />
And there were a few ownership and permissions problems to be cleaned up<br />
after that.</p>
<p>Once burned twice shy.  This is the only truly catastrophic mistake I&#8217;ve<br />
ever made as a sysadmin, I&#8217;m glad to be able to say.</p>
<p>I kept a copy of my memo to the users after I had done what I could.<br />
Reading it over now is sobering indeed!  I also kept my extensive notes<br />
on the restore process &#8211; thank goodness I&#8217;ve never had to use them since.</p></blockquote>
<p>5</p>
<blockquote><p>From: jimh@pacdata.uucp (Jim Harkins)<br />
Organization: Pacific Data Products</p>
<p>A friend of mine admins an RS6000 for a state college.  The weekend before<br />
the fall semester started the Powers That Be decided to physically move the<br />
system to a different room.  She stayed late friday night, moved the machine,<br />
and then it wouldn&#8217;t boot.  I was in Sunday afternoon looking at it, wouldn&#8217;t<br />
boot for nothing.  Monday morning, first day of classes, an IBM rep comes in<br />
and reformats the hard disk without telling her.  Turns out this was the<br />
machine all the professors were doing their class plans on.  So not only<br />
couldn&#8217;t they have them printed out, but when school started monday morning<br />
the teachers discovered they had lost all the work they&#8217;d done in the week<br />
before school started.  Seems she never did backups because the teachers<br />
always bitched about how slow the system was when she did, and she hadn&#8217;t<br />
learned about cron yet (I told her about that one).</p>
<p>In her defense, she&#8217;d only been using the RS6000 for less than a month before<br />
this happened.  She didn&#8217;t know UNIX.  She hadn&#8217;t had any training.  She<br />
still had her regular job to do.</p>
<p>To make things worse, when she called me monday night she was in tears as<br />
she told me how she had to personally visit all the professors and tell them<br />
their work was gone.  I blurted out &#8220;Stupid of you not to make backups&#8221;.  Here<br />
she is looking for a shoulder to cry on and I go and tell her the same thing<br />
everybody from the department chair on down to the janitor had been saying.<br />
Oops.</p>
<p>The moral?  If you appoint someone to admin your machine you better be willing<br />
to train them.  If they&#8217;ve never had a hard disk crash on them you might want<br />
to ensure they understand hardware does stuff like that.  I also found out<br />
she was unplugging and plugging cables all over the place without powering<br />
down the system.  Her hardware knowledge was essentially &#8220;this thing goes into<br />
the wall, then the lights blink&#8221;.</p></blockquote>
<p>7</p>
<blockquote><p>From: rick@sadtler.com (Rick Morris)<br />
Organization: Sadtler Research Laboratories</p>
<p>Slightly off the subject, but not too far off, is the phenomenon of &#8220;Sysadmin<br />
Wannabees.&#8221;  I&#8217;ve been Sys Admin of UNIX at 3 sites now.  The phenomenon has<br />
occured at all three.</p>
<p>You are talking to a fellow programmer, or a programmer is within ear shot.<br />
A new user (or even an old user) comes up to you and asks something like:<br />
&#8220;How would I list only directory files within a directory?&#8221;</p>
<p>Now it has been my experience that the question is not complete.  Is this a<br />
recursive list?  Is this a &#8220;one-time&#8221; thing, or are you going to do it many<br />
times?  Is it part of a program?  (Sometimes questions like this end up as<br />
an answer to a C question executed as a system(3) call rather than a preferred<br />
library call.)  Anyway, as you ponder the question, the many alternatives (in<br />
unix there&#8217;s always another way), the questioner&#8217;s experience, whether or not<br />
they want a techie answer or a DOSie answer, the programmer within ear shot<br />
pipes in with an answer of how *THEY* do or would do it.</p>
<p>It is invariable.  It happens every time.  I don&#8217;t think I take all that<br />
long to answer.  But the Wannabee answer is rapid.  Like the kid in class<br />
who raises his hand going &#8220;oo&#8221; &#8220;oo&#8221; &#8220;oo&#8221;.</p>
<p>I have seen my predicessors get all bent out of shape when the Sysadmin<br />
Wannabees jump on their toes.  I usually let the answer proceed, indeed,<br />
often these Wannabees give a complete answer, even doing it for the<br />
questioner.  After a bit I return to the questioner and ask if the question<br />
was properly answered, if they understand the answer, or if they want any<br />
more information.  It also shows me how deeply the Wannabee understands<br />
just what is going on inside that pizza box.</p>
<p>Have any other of you sys admins seen this phenomenon, or is it my slow<br />
pondering of potential answers that drives the Wannabee to jump in?</p></blockquote>
<p>8</p>
<blockquote><p>From: rslade@cue.bc.ca (Rob Slade)<br />
Organization: Computer Using Educators of B.C., Canada</p>
<p>I had a job one time teaching Pascal at a &#8220;visa school&#8221;.  The machine was a<br />
multi-user micro that ran UNIX.  I have enough stories from that one course<br />
to keep a group of computer educators in stitches for at least half an hour.</p>
<p>The finale of the course was on the last day of classes.  When I showed up<br />
and powered up the system, it refused to boot.  Since all the students&#8217; term<br />
projects and papers were in the computer, it was fairly important.  After<br />
a few hours of work, and consultation with the other teacher, who did the<br />
sysadmin and maintenance, we were finally informed that the new admin<br />
assistant around the place had decided that the layout of the computer lab<br />
was unsuitable.  (I had noticed that all the desk were repositioned: I thought<br />
the other teacher had done it, he thought I had.)  The AA had, the night<br />
before, moved all the furniture, including the terminals and the micro.  She<br />
did not know anything about parking hard disks.</p>
<p>We knew now, that we were in trouble, but we didn&#8217;t realize how much until<br />
we started reading up on emergency procedures.  For some unknown reason,<br />
booting the micro from the original system disks would automatically reformat<br />
the hard disk.</p>
<p>(The visa school refunded the tuition for all the students in that course.)</p></blockquote>
<p>9</p>
<blockquote><p>From: corwin@ensta.ensta.fr (Gilles Gravier)<br />
Organization: ENSTA, Paris, France</p>
<p>I am sysadmin at my office&#8230; I won&#8217;t name it, because that&#8217;s not<br />
the subject&#8230; Of course, UNIX is my cup of tea&#8230; But, at home, I have an<br />
MS DOS machine&#8230; As old habits die hard, I have set up MKS toolkit on my home<br />
PC&#8230; And, as I have a C:\TMP directory where Windows and other applications<br />
put stuff, that remains, as I sometimes have to reboot fast&#8230; (ah, the fun<br />
of developping at home!)&#8230; So, in my AUTOEXEC.BAT file, I have the following:<br />
rm -rf /tmp<br />
mkdir c:\tmp<br />
the recursive rm comming from MKS, and mkdir from horrible MSDOS.</p>
<p>At the time, I didn&#8217;t have a tape streamer on my pc&#8230; I was working,<br />
and the mains waint down&#8230; so did the PC.   Windows was running, \TMP full<br />
of stuff&#8230; So, when powers comes back on, rm -rf /tmp has things to do&#8230;<br />
While it&#8217;s doing those things, power goes down again (there was  a storm).<br />
Power comes back up, and this time, it seems that the autoexec takes really<br />
too much time&#8230; So, I control C it&#8230; And, to my horror, realize that I don&#8217;t<br />
have anymore C:\DOS C:\BIN C:\USR and that my C:\WINDOWS was quite depleted&#8230;</p>
<p>	After some investigation, unsuccesfull, I did the following: cd \tmp<br />
and then DIR&#8230; And there, in C:\TMP, I find my C:\ files! The first power<br />
down had resulted in the cluster number of C:\ being copied to that of C:\TMP,<br />
actually resulting in a LINK! (Now, this isn&#8217;t suppose to happen under MSDOS!)<br />
I had to patch in the DIRECTORY cluster to change TMP&#8217;s name replacing the<br />
first T by the letter Sigma, so that DOS tought that TMP wasn&#8217;t there anymore,<br />
then do an chkdsk /F, and then undelete the files that I could&#8230; And rebuild<br />
the rest&#8230;</p></blockquote>
<p>10</p>
<blockquote><p>From: gert@greenie.gold.sub.org (Gert Doering)</p>
<p>I was on a 5 days vacation, the first day my machine crashed&#8230;</p>
<p>How?  Well&#8230;</p>
<p>cron started a shell-skript to extract some files from a &#8220;.lzh&#8221;-Archive.<br />
LHarc found that the target file already existed, asked</p>
<p>&#8220;file <foo> exists, overwrite (y/n)?&#8221;</p>
<p>&#8230; since it was started from cron, it just read &#8220;EOF&#8221;.  Tried again.  Read<br />
&#8220;EOF&#8221;.  And so on.</p>
<p>All output went to /tmp&#8230; what was full after the file reached 90 MB!<br />
What happened next?  I&#8217;m using a SCO machine, /tmp is in my root filesystem<br />
and when trying to login, the machine said something about being not able<br />
to write loggin informations &#8211; and threw me out again.</p>
<p>Switched machine off.</p>
<p>Power on, go to single user mode.  Tried to login &#8211; immediately thrown out<br />
again.</p>
<p>I finally managed to repair the mess by booting from Floppy disk, mounting<br />
(and fsck-ing) the root filesystem and cleaning /tmp/*</p></blockquote>
]]></content:encoded>
			<wfw:commentRss>http://www.unixnewbie.org/sysadmin-stories-miscellaneous/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
