<?xml version="1.0" encoding="utf-8"?>
<!-- generator="" -->
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title>Linux - Unix</title>
		<description><![CDATA[Leading Network Security & Cyber Security site. Cisco Routing/Switching, VPN, Microsoft, SASE, SSE, F5, PaloAlto Firewalls, Protocol Analysis, Tips & more.]]></description>
		<link>https://www.firewall.cx/operating-systems/linux-unix.html</link>
		<lastBuildDate>Sat, 11 Apr 2026 12:45:26 +1000</lastBuildDate>
		<generator></generator>
		<atom:link rel="self" type="application/rss+xml" href="https://www.firewall.cx/operating-systems/linux-unix.feed?type=rss"/>
		<language>en-gb</language>
		<item>
			<title>Critical 15 Year-old Linux Security Hole (Ghost) Revealed</title>
			<link>https://www.firewall.cx/operating-systems/linux-unix/linux-ghost-security-gnu-lib-vulnerability.html</link>
			<guid isPermaLink="true">https://www.firewall.cx/operating-systems/linux-unix/linux-ghost-security-gnu-lib-vulnerability.html</guid>
			<description><![CDATA[<p style="text-align: justify;"><img src="https://www.firewall.cx/images/stories/linux-ghost-security-gnu-lib-vulnerability-1.jpg" alt="linux-ghost-security-gnu-lib-vulnerability-1" style="margin: 7px; float: left;" title="Linux Ghost Security Hole " />Security researchers at qualys.com yesterday released information on a <strong>critical 15 year-old Linux security hole</strong> which affects millions of Linux systems dated back to the year 2000.&nbsp; The <strong>newly published security hole</strong> – code named ‘<strong>Ghost</strong>’&nbsp; was revealed yesterday by Qualy’s security group on openwall.com.</p>
<p style="text-align: justify;">The security hole was found in the <strong>__nss_hostname_digits_dots() function</strong> of the <strong>GNU C Library</strong> (<strong>glibc</strong>).</p>
<p style="text-align: justify;">The function is used on almost all networked Linux computers when the computer tries to access another networked computer either by using the <strong>/etc/hosts</strong> files or, more commonly, by resolving a domain name with <a href="https://www.firewall.cx/operating-systems/linux-unix.html" target="_blank" title="Linux DNS Services - Installation and Setup">Domain Name System</a> (<strong>DNS</strong>)</p>
<p style="text-align: justify;">As noted by the security team, the bug is reachable both <strong>locally</strong> and <strong>remotely</strong> via the <strong>gethostbyname*() functions</strong>, making it possible <strong>remotely exploit it</strong> by triggering a <strong>buffer overflow</strong> by using an <strong>invalid hostname argument</strong> to an application that performs <strong>DNS resolution</strong>.</p>
<p style="text-align: justify;">The <strong>security hole exists</strong> in <strong>any Linux system</strong> that was built with <strong>glibc-2.2</strong> which was released in <strong>November 10th, 2000</strong>. Qualy mentioned that the bug was <strong>patched</strong> on <strong>May 21st, 2013</strong> in releases <strong>glibc-2.17 and glibc-2.18</strong>.</p>
<p style="text-align: justify;">Linux systems that are considered vulnerable to the attack include <strong>RedHat Enterprise Linux 5</strong>, <strong>6</strong> and <strong>7</strong>, <strong>CentOS 6 and 7</strong>,&nbsp; <strong>Ubuntu 12.04</strong> and <strong>Debian 7</strong> (<strong>Wheezy</strong>).</p>
<p style="text-align: justify;"><strong>Debian</strong> has is already <strong>patching</strong> its core systems (https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=776391) while <strong>Ubuntu</strong> has already patched its <strong>12.04 and 10.04 distributions</strong> (https://www.ubuntu.com/usn/usn-2485-1/). <strong>CentOS patches</strong> are also on their way. </p>]]></description>
			<category>Linux - Unix</category>
			<pubDate>Thu, 29 Jan 2015 07:54:29 +1100</pubDate>
		</item>
		<item>
			<title>Linux CentOS - Redhat EL Installation on HP Smart Array B110i SATA RAID Controller - HP ML/DL Servers</title>
			<link>https://www.firewall.cx/operating-systems/linux-unix/linux-b110i-sata-controller.html</link>
			<guid isPermaLink="true">https://www.firewall.cx/operating-systems/linux-unix/linux-b110i-sata-controller.html</guid>
			<description><![CDATA[<p style="text-align: justify;">This article was written thanks to our recent encounter of a <strong>HP DL120 G7 rack mount server</strong> equipped with a <strong>HP Smart Array B110i SATA Raid controller</strong>, needed to be installed with the <strong>Linux CentOS 6.0 operating system</strong>.&nbsp; The <strong>HP Smart Array B110i SATA Raid controller</strong> is found on a variety of HP servers, therefore this procedure can be applied to all HP servers equipted with the <strong>Smart Array B110i controller</strong>.</p>
<p style="text-align: justify;">As with all articles, we have included step-by-step instructions of the <strong>HP Smart Array B110i SATA Raid controller drivers</strong>, including screenshots (from the server’s monitor), files, drivers and utilities that might be needed.</p>
<p class="box-download" style="text-align: justify;"><strong>Provided Download Files:</strong>&nbsp; <a href="https://www.firewall.cx//downloads/linux-tools-and-applications.html" target="_blank" title="HP Smart Array B110i SATA Controller Driver Diskete &amp; Utilities ">HP Smart Array B110i Drivers (Redhat 6.0, CentOS 6.0), RawWrite &amp; Win32DiskImager</a>&nbsp;</p>
<h2>The HP SmartArray B110i Story</h2>
<p style="text-align: justify;">What was supposed to be pretty straight-forward process, turned out to become a 3 hour troubleshooting session to figure out how to install the necessary Smart Array B110i drivers so that our CentOS 6.0 or Redhat Enterprise Linux 6.0&nbsp; install process, would recognize our RAID volumes and proceed with the installation of the operating system.</p>
<p style="text-align: justify;">A quick search on Google revealed that we were not alone – hundreds of people seem to have struggled with the same issue long before we did, however we couldn’t locate an answer that provided full instructions on how to deal with the problem, so, we decided to create one that did!</p>
<h2>Installation Steps</h2>
<p style="text-align: justify;">First step is to enter the server’s <strong>BIOS</strong> and ensure to <strong>Enable SATA RAID Support</strong>. This will essentially enable the controller and allow the setup RAID from within the controller. On the <strong>HP DL120G7</strong> this option was under the <strong>Advanced Options</strong> &gt; <strong>Embedded SATA Configuration</strong> &gt; <strong>Enable SATA RAID Support</strong> menu:</p>
<p align="center"><img src="https://www.firewall.cx//images/stories/linux-b110i-installation-1.jpg" alt="linux HP b110i installation " width="600" height="372" style="display: block; margin-left: auto; margin-right: auto;" title="HP DL120 Bios - Enable SATA RAID Support" /></p>
<p style="text-align: justify;">Next step is to save and exit the BIOS.&nbsp;&nbsp;</p>
<p style="text-align: justify;">While the server restarts, when prompted, press <strong>F8 </strong>to enter the RAID Controller menu and create the necessary RAID and logical volumes. We created two logical drives in a <strong>RAID 0</strong> configuration <strong>9.3GB</strong> &amp; <strong>1.8TB</strong> capacity:</p>
<p align="center"><img src="https://www.firewall.cx//images/stories/linux-b110i-installation-2.jpg" alt="HP b110i logical drive configuration" width="600" height="360" style="display: block; margin-left: auto; margin-right: auto;" title="HP Smart Array B110i SATA Raid controller Setup" /></p>
<p style="text-align: justify;">Next, it was time to prepare the necessary driver disk so that the operating system can ‘see’ the raid controller and drives created. For this process, two things are needed:</p>
<ul>
<li>Correct Disk Driver</li>
<li>Create Driver Diskette</li>
</ul>
<h2>Selecting The Correct Disk Driver</h2>
<p style="text-align: justify;">HP offers drivers for the <strong>B110i controller</strong> for a variety of operating systems, including Redhat and SUSE, both for Intel and AMD based CPU systems. The driver diskette image provides the binary driver modules pre-built for Linux, which enables the HP Smart Array B110i SATA RAID Controller. CentOS users can make use of the Redhat drivers without hesitation.</p>
<p style="text-align: justify;">For this article we are providing as a direct download, drivers for <strong>RedHat Enterprise Linux</strong> &amp; <strong>CentOS v6.0</strong> for Intel and AMD 64bit processors (x86-64bit). These files are available at our <a href="https://www.firewall.cx/downloads/linux-tools-and-applications.html" target="_blank" title="Linux download section">Linux download section</a>.</p>
<p style="text-align: justify;">&nbsp;If a diskette driver for earlier or later systems is required, we advise to visit HP’s website and search for the term “<strong><em>Driver Diskette for HP Smart Array B110i</em></strong>” which will produce a good amount of results for all operating systems.</p>
<p style="text-align: justify;">Driver diskette file names have the format “<strong><em>hpahcisr-1.2.6-11.rhel6u0.x86_64.dd.gz</em></strong>” where <strong>rhel</strong> represents the operating system (<strong>R</strong>ed<strong>H</strong>at <strong>E</strong>nterprise <strong>L</strong>inux), <strong>6u0</strong> stands for update 0 (version 6, update 0 = 6.0) and <strong>x86_64</strong> for the system architecture covering x86 platforms (Intel &amp; AMD).</p>
<h2>Writing Image To Floppy Disk Or USB Flash</h2>
<p style="text-align: justify;">The driver diskette must be uncompressed using a utility such as 7zip (freely available). Uncompressing the file reveals the file <strong>dd.img</strong> . This is the driver disk image that needs to be written to a floppy disk drive or USB flash.</p>
<p style="text-align: justify;">Linux users can use the following command to create their driver diskette. Keep in mind to substitute <strong>/dev/sdb</strong> to reflect your usb or floppy drive:</p>
<div class="box-content" style="text-align: justify;"># <strong>dd if=hpahcisr-1.2.6-11.rhel6u0.x86_64.dd.gz of=/dev/sdb</strong></div>
<p style="text-align: justify;">Windows users can use <strong>RawWrite </strong>if they wish to write it to a floppy disk drive or <strong>Win32DiskImager </strong>to write it to a USB Flash. Both utilities are provided with our <span style="color: #ff0000;">disk driver download</span>. Since we had a USB floppy disk drive in hand, we selected <strong>RawWrite</strong>:</p>
<p align="center"><img src="https://www.firewall.cx//images/stories/linux-b110i-installation-3.jpg" alt="rawwrite usage and screenshot" width="377" height="386" style="display: block; margin-left: auto; margin-right: auto;" title="RaWrite " /></p>
<h2 style="text-align: justify;">Loading The Driver Diskette</h2>
<p style="text-align: justify;">With the driver diskette ready, it’s time to begin the<strong> CentOS installation</strong>, by booting from the DVD:</p>
<p align="center"><img src="https://www.firewall.cx//images/stories/linux-b110i-installation-4.jpg" alt="centos 6.0 welcome installation" width="600" height="375" style="display: block; margin-left: auto; margin-right: auto;" title="CentOS Installation" /></p>
<p style="text-align: justify;">At the installation menu, hit <strong>ESC</strong> to receive the <strong>boot:</strong> prompt. At the prompt, enter the following command: <strong>linux dd blacklist=ahci</strong> and hit enter to being installation as shown below:</p>
<p align="center"><img src="https://www.firewall.cx//images/stories/linux-b110i-installation-5.jpg" alt="centos 6 initrd.img driver installation" width="600" height="376" style="display: block; margin-left: auto; margin-right: auto;" title="CentOS Installation linux dd blacklist=ahci" /></p>
<p style="text-align: justify;">The initial screen of the installation GUI will allow you to load the driver diskette created. At the question, select <strong>Yes</strong> and <strong>hit enter</strong>:</p>
<p align="center"><img src="https://www.firewall.cx//images/stories/linux-b110i-installation-6.jpg" alt="linux-b110i-installation-6" width="600" height="377" style="display: block; margin-left: auto; margin-right: auto;" title="Linux CentOS Installation - Driver Disk for HP RAID Controller" /></p>
<p style="text-align: justify;">Next screen instructs to insert the driver disk into <strong>/dev/sda</strong> and press <strong>OK</strong>.&nbsp; The location <strong>/dev/sda</strong> refers to our USB Floppy drive, connected to one of our HP server's USB ports during bootup:</p>
<p align="center"><img src="https://www.firewall.cx//images/stories/linux-b110i-installation-7.jpg" alt="linux-b110i-installation-7" width="600" height="371" style="display: block; margin-left: auto; margin-right: auto;" title="HP Smart Array B110i SATA Raid controller Driver Disk Installation" /></p>
<p style="text-align: justify;">The system will present a screen with the message <strong>Reading driver disk</strong>, indicating the driver is loading and once complete, the message <strong>detecting hardware … waiting for hardware to initialize…</strong> will appear:</p>
<p align="center"><img src="https://www.firewall.cx//images/stories/linux-b110i-installation-8.jpg" alt="linux-b110i-installation-8" width="600" height="369" style="display: block; margin-left: auto; margin-right: auto;" title="Linux CentOS HP Smart Array B110i SATA Raid controller installation" /></p>
<p style="text-align: justify;">Finally, the installation procedure asks if you wish you load any more driver disks. We answered <strong>No</strong> and the installation procedure continued as expected. We saw both logical disks and were able to successfully install and use them without any problem:</p>
<p align="center"><img src="https://www.firewall.cx/images/stories/linux-b110i-installation-9.jpg" alt="linux centos logical drive setup" width="581" height="397" title="HP Smart Array B110i SATA Raid controller - Logic Partitions" /></p>
<p style="text-align: justify;">We hope this brief article will help thousands of engineers around the world save a bit of their valuable time!</p>]]></description>
			<category>Linux - Unix</category>
			<pubDate>Mon, 06 Aug 2012 08:11:22 +1000</pubDate>
		</item>
		<item>
			<title>Installing &amp; Configuring Linux Webmin - Linux Web-Based Administration</title>
			<link>https://www.firewall.cx/operating-systems/linux-unix/linux-webmin-config.html</link>
			<guid isPermaLink="true">https://www.firewall.cx/operating-systems/linux-unix/linux-webmin-config.html</guid>
			<description><![CDATA[<p style="text-align: justify;">For many engineers and administrators,&nbsp; maintaining a Linux system can be a daunting task, especially if there’s limited time or experience.&nbsp; Working in shell mode, editing files, restarting services, performing installations, configuring scheduled jobs (Cron Jobs) and much more, requires time, knowledge and patience.</p>
<p style="text-align: justify;">One of the biggest challenges for people who are new to Linux, is to work with the operating system in an easy and manageable way, without requiring to know all the commands and file paths in order to get the job done.</p>
<p style="text-align: justify;">All this has now changed, and you can now do all the above, plus a lot more, with a few simple clicks through an easy-to-follow web interface.&nbsp; Sounds too good to be true? &nbsp;Believe it or not, it is true!&nbsp; It's time to get introduced to ‘<strong>Webmin</strong>’.</p>
<p style="text-align: justify;">Webmin is a freeware program that provides web-based interface for system administration and is a system configuration tool for administrators. One of Webmin's strongest points is that it is modular, which means there are hundreds of extra modules/addons that can be installed, to provide the ability to control additional programs or services someone might want to install on their Linux system.</p>
<p style="text-align: justify;">Here are just a few of the features supported by Webmin, out of the box:</p>
<ul>
<li>Setup and administer user accounts</li>
<li>Setup and administer groups</li>
<li>Setup and configure DNS services</li>
<li>Configure file sharing &amp; related services (Samba)</li>
<li>Setup your Internet connection (including ADSL router, modem etc)</li>
<li>Configure your Apache webserver</li>
<li>Configure a FTP Server</li>
<li>Setup and configure an email server</li>
<li>Configure Cron Jobs</li>
<li>Mount, dismount and administer volumes, hdd's and partitions</li>
<li>Setup system quotas for your users</li>
<li>Built-in file manager</li>
<li>Manage an OpenLDAP server</li>
<li>Setup and configure VPN clients</li>
<li>Setup and configure a DHCP Server</li>
<li>Configure a SSH Server</li>
<li>Setup and configure a Linux Proxy server (squid) with all supported options</li>
<li>Setup and configure a Linux Firewall</li>
<li>and much much more!!!</li>
</ul>
<p>The great part is that webmin is supported on all Linux platforms and is extremely easy to install.&nbsp; While our example is based on Webmin's installation on a Fedora 16 server using the RPM package, these steps will also work on other versions such as Red Hat, CentOS and other Linux distributions.</p>
<p style="text-align: justify;">Before we dive into Webmin, let's take a quick look at what we've got covered:</p>
<ul class="checkbox">
<li>Webmin Installation</li>
<li>Adding Users, Groups and Assigning Privileges</li>
<li>Listing and Working with File Systems on the System</li>
<li>Creating and Editing Disk Quotas for Unix Users</li>
<li>Editing the System Boot up, Adding and Removing Services</li>
<li>Managing and Examining System Log Files</li>
<li>Setting up and Changing System Timezone and Date</li>
<li>Managing DNS Server &amp; Domain</li>
<li>Configuring DHCP Server and Options</li>
<li>Configuring FTP Server and Users/Groups</li>
<li>How to Schedule a Backup</li>
<li>Configuring CRON Jobs with Webmin</li>
<li>Configuring SSH Server with Webmin</li>
<li>Configuring Squid Proxy Server</li>
<li>Configuring Apache HTTP Server</li>
</ul>
<h2>Installing Webmin On Linux Fedora / Redhat / CentOS</h2>
<p style="text-align: justify;">Download the required RPM file from http://download.webmin.com/download/yum/ using the command (note the root status):</p>
<p class="box-content" style="text-align: justify;"># <strong>wget http://download.webmin.com/download/yum/webmin-1.580-1.noarch.rpm</strong></p>
<p style="text-align: justify;">Install the RPM file of Webmin with the following command:</p>
<div class="box-content" style="text-align: justify;"># <strong>rpm -Uvh webmin-1.580-1.noarch.rpm</strong></div>
<p style="text-align: justify;">Start Webmin service using the command:</p>
<div class="box-content" style="text-align: justify;"># <strong>systemctl start webmin.service</strong></div>
<p style="text-align: justify;">You can now login to <strong>https://Fedora-16:10000/</strong> as root with your root password. To ensure you are able to login into your webmin administration interface, simply use the following URL:&nbsp; <strong>https://<em>your-linux-ip</em>:10000</strong> , where "<strong><em>your-linux-ip</em></strong>" is your Linux server's or workstation's IP address.</p>
<h2>Running Webmin</h2>
<p style="text-align: justify;">Open Firefox or any other browser, and type the URL <strong>https://Fedora-16:10000/ :<br /></strong></p>
<p style="text-align: justify;"><img src="https://www.firewall.cx//images/stories/linux-webmin-1.jpg" alt="linux-webmin-1" width="632" height="249" style="display: block; margin-left: auto; margin-right: auto;" title="Login into Webmin" /></p>
<p style="text-align: justify;">&nbsp;</p>
<p style="text-align: justify;">You will be greeted with a welcome screen. Login as root with your root password. Once you are logged in, you should see the system information:</p>
<p style="text-align: justify;"><img src="https://www.firewall.cx//images/stories/linux-webmin-2.jpg" alt="linux-webmin-2" width="665" height="385" style="display: block; margin-left: auto; margin-right: auto;" title="Webmin Control Panel - Homepage" /></p>
<h2>Adding Users, Groups And Assigning Them Privileges</h2>
<p style="text-align: justify;">Expand the "<strong>System</strong>" Tab in the left column index, and select the last entry “<strong>Users and Groups</strong>”.&nbsp; You will be shown the list of the "<strong>Local Users</strong>" on the system:</p>
<p style="text-align: justify;"><img src="https://www.firewall.cx//images/stories/linux-webmin-3.jpg" alt="linux-webmin-3" width="642" height="498" style="display: block; margin-left: auto; margin-right: auto;" title="Webmin Adding Users, Groups and Assigning them Privileges " /></p>
<p style="text-align: justify;">You can add users or delete them from this window. If you want to change the parameters of any user, you can do so. By clicking on any user, you can see the groups and privileges assigned to them. These can be changed as you like. For example, if you select the user "<strong>root</strong>", you can see all the details of the user as shown below :</p>
<p style="text-align: justify;"><img src="https://www.firewall.cx//images/stories/linux-webmin-4.jpg" alt="linux-webmin-4" width="635" height="498" style="display: block; margin-left: auto; margin-right: auto;" title="Webmin Adding Users, Groups and Assigning them Privileges " /></p>
<p style="text-align: justify;">By selecting the adjacent tab in the "<strong>Users and Groups</strong>" window, you can see the "<strong>Local Groups</strong>" as well:</p>
<p style="text-align: justify;"><img src="https://www.firewall.cx//images/stories/linux-webmin-5.jpg" alt="linux-webmin-5" width="636" height="454" style="display: block; margin-left: auto; margin-right: auto;" title="Webmin adding groups" /></p>
<p style="text-align: justify;">Here, you can see the members in each group by selecting that group. You can delete a group or add a new one. You can select who will be the member of the group, and who can be removed from a group. For example, you can see all the members in the group "<strong>mem</strong>", if you select and open it:</p>
<p style="text-align: justify;"><img src="https://www.firewall.cx//images/stories/linux-webmin-6.jpg" alt="linux-webmin-6" width="638" height="484" style="display: block; margin-left: auto; margin-right: auto;" title="Webmin Edit a Group" /></p>
<p style="text-align: justify;">Here, you will be allowed to create a new group or delete selected groups. You can also add users to the groups or delete them as required. If required, you can also change group ID on files and modify a group other modules as well.</p>
<h2>Listing And Working With File Systems On The System</h2>
<p style="text-align: justify;">By selecting "<strong>Disk and Network Filesystems</strong>" under the "<strong>System</strong>" tab on the left index, you can see the different file systems currently mounted.</p>
<p style="text-align: justify;"><img src="https://www.firewall.cx//images/stories/linux-webmin-7.jpg" alt="linux-webmin-7" width="641" height="499" style="display: block; margin-left: auto; margin-right: auto;" title="Webmin - Disk and Network file systems" /></p>
<p style="text-align: justify;">You can select other type of file system you would like to mount. Select it from the drop down menus as shown:</p>
<p style="text-align: justify;"><img src="https://www.firewall.cx//images/stories/linux-webmin-8.jpg" alt="linux-webmin-8" width="643" height="497" style="display: block; margin-left: auto; margin-right: auto;" /></p>
<p style="text-align: justify;">By selecting a mounted file system, you can edit its details such as whether it should be mounted at boot time, left as mounted or unmount it now, check the file system at boot time. Mount options like read-only, executable, permissions can be set here.</p>
<h2>Creating And Editing Disk Quotas For Unix Users</h2>
<p style="text-align: justify;">Prior to Linux Installation, a major &amp; key point in Linux Partition is the <strong>/home</strong> directory.</p>
<p style="text-align: justify;">VHost is widely setup on almost all control panel mechanism on <strong>/home</strong> location, since Users &amp; Groups, FTP server, User shell, Apache and several other directives are constructed on this <strong>/home</strong> partition. Therefore, home should be created as a Logical Volume on a Linux native File system (ext3). Here it is assumed there is already a <strong>/home </strong>partition on the system.</p>
<p style="text-align: justify;">You can set the quotas by selecting “<strong>Disk &amp; Network Filesystems</strong>” under “<strong>System</strong>”:</p>
<p style="text-align: justify;"><img src="https://www.firewall.cx//images/stories/linux-webmin-9.jpg" alt="linux-webmin-9" width="640" height="498" style="display: block; margin-left: auto; margin-right: auto;" title="Webmin Creating and Editing Disk Quotas for Unix Users " /></p>
<p style="text-align: justify;">This allows you to create and edit disk quota for the users in your <strong>/home</strong> partition or directory. Each user is given a certain amount of disk space he can use. Going close to filling up the quota will generally send a warning.</p>
<p style="text-align: justify;">You can also edit other mounts such as the root directory "<strong>/</strong>" and also set a number of presented mount options:</p>
<p style="text-align: justify;"><img src="https://www.firewall.cx//images/stories/linux-webmin-10.jpg" alt="linux-webmin-10" width="639" height="424" style="display: block; margin-left: auto; margin-right: auto;" /></p>
<h2 style="text-align: justify;">Editing The System Boot Up, Adding And Removing Services</h2>
<p style="text-align: justify;">All Systemd services are neatly listed in the "<strong>Bootup and Shutdown</strong>" section within "<strong>System</strong>":</p>
<p><img src="https://www.firewall.cx//images/stories/linux-webmin-11.jpg" alt="linux-webmin-11" width="639" height="440" style="display: block; margin-left: auto; margin-right: auto;" title="Webmin - Editing the System Boot up, Adding and Removing Services" /></p>
<p style="text-align: justify;">All service related functions such as start, stop, restart, start on boot, disable on boot, start now and on boot, and disable now and on boot are available at the bottom of the screen. This makes system bootup process modification a breeze, even for the less experienced:</p>
<p><img src="https://www.firewall.cx//images/stories/linux-webmin-12.jpg" alt="linux-webmin-12" width="642" height="440" style="display: block; margin-left: auto; margin-right: auto;" /></p>
<p style="text-align: justify;">&nbsp;The "<strong>Reboot System</strong>" and "<strong>Shutdown System</strong>" function buttons are also located at the bottom, allowing the immediately reboot or shutdown the system.</p>
<h2>Managing And Examining System Log Files</h2>
<p style="text-align: justify;">Who would have thought managing system log files in Linux would be so easy? Webmin provides a dedicated section allowing the admnistrator to make a number of changes to the preferences of each system's log file. The friendly interface will show you all available system log files and their location.&nbsp; By clicking on the one of interest, you can see its properties and make the changes you require.</p>
<p style="text-align: justify;">The following screenshot shows the "<strong>System Logs</strong>" listed in the index under "<strong>System</strong>" menu option:</p>
<p><img src="https://www.firewall.cx//images/stories/linux-webmin-13.jpg" alt="linux-webmin-13" width="640" height="440" style="display: block; margin-left: auto; margin-right: auto;" title="Webmin Managing and Examining System Log Files " /></p>
<p style="text-align: justify;">All the logs are available for viewing and to editing. The screenshot below shows an example of editing the maillog. Through the interface, you can enable, disable logs and make a number of other changes on the fly:</p>
<p><img src="https://www.firewall.cx//images/stories/linux-webmin-14.jpg" alt="linux-webmin-14" width="639" height="440" style="display: block; margin-left: auto; margin-right: auto;" /></p>
<p style="text-align: justify;">Another entry under "<strong>System</strong>" is the important function of "<strong>Log File Rotation</strong>". This allows you to edit which log file you would like to rotate and how (daily, weekly or monthly). You can define what command will be executed after the log rotation is done. You can also delete the selected log rotations:</p>
<p><img src="https://www.firewall.cx//images/stories/linux-webmin-15.jpg" alt="linux-webmin-15" width="637" height="441" style="display: block; margin-left: auto; margin-right: auto;" /></p>
<p>Log rotation is very important, especially on a busy system as it will ensure the log files are kept to a reasonable and manageable size.</p>
<h2>Setting Up And Changing System Timezone/Date</h2>
<p style="text-align: justify;">Webmin also supports setting up system time and date. To do so, you will have to go to "<strong>System Time</strong>" under "<strong>Hardware</strong>" in the main menu index.</p>
<p><img src="https://www.firewall.cx//images/stories/linux-webmin-16.jpg" alt="linux-webmin-16" width="640" height="331" style="display: block; margin-left: auto; margin-right: auto;" title="Webmin - Setting up and Changing System Timezone and Date " /></p>
<p style="text-align: justify;">System time and hardware time can be separately set and saved. These can be made to match if required.</p>
<p style="text-align: justify;">On the next tab you will be able to change the <strong>Timezone</strong>:</p>
<p><img src="https://www.firewall.cx//images/stories/linux-webmin-17.jpg" alt="linux-webmin-17" width="633" height="332" style="display: block; margin-left: auto; margin-right: auto;" /></p>
<p style="text-align: justify;">The next tab is the '<strong>Time Server Sync</strong>', used for synchronizing to a time-server. This will ensure your system is always in sync with the selected time-server:</p>
<p><img src="https://www.firewall.cx//images/stories/linux-webmin-18.jpg" alt="linux-webmin-18" width="639" height="440" style="display: block; margin-left: auto; margin-right: auto;" /></p>
<p style="text-align: justify;">Here, you will be able to select a specific timeserver with a hostname or address and set the schedule when the periodic synchronizing will be done.</p>
<h2 style="text-align: justify;">Managing DNS Server &amp; Domain</h2>
<p style="text-align: justify;">DNS Server configuration is possible from the "<strong>Hostname and DNS Client</strong>", which is located under "<strong>Networking Configuration</strong>" within "<strong>Networking</strong>" in the index:</p>
<p><img src="https://www.firewall.cx//images/stories/linux-webmin-19.jpg" alt="linux-webmin-19" width="638" height="404" style="display: block; margin-left: auto; margin-right: auto;" title="Webmin - Managing DNS Server &amp; Domain" /></p>
<p>Here you can set the Hostname of the machine, the IP Address of the DNS Servers and their search domains and save them.</p>
<h2>Configuring DHCP Server And Options</h2>
<p style="text-align: justify;">For configuration of your system's DHCP server, go to “<strong>DHCP Server</strong>” within “<strong>System and Server Status</strong>” under “<strong>Others</strong>”:</p>
<p><img src="https://www.firewall.cx//images/stories/linux-webmin-20.jpg" alt="linux-webmin-20" width="640" height="438" style="display: block; margin-left: auto; margin-right: auto;" title="Webmin - Configuring DHCP Server and Options " /></p>
<p style="text-align: justify;">All parameters related to DHCP server can be set here:</p>
<p><img src="https://www.firewall.cx//images/stories/linux-webmin-21.jpg" alt="linux-webmin-21" width="639" height="416" style="display: block; margin-left: auto; margin-right: auto;" /></p>
<h2>Configuring FTP Server And Users/Groups</h2>
<p style="text-align: justify;">For ProFTPD Server, select “ <strong>ProFTPD Server</strong>” under “<strong>Servers</strong>”. You will see the main menu for ProFTPD server:</p>
<p><img src="https://www.firewall.cx//images/stories/linux-webmin-22.jpg" alt="linux-webmin-22" width="638" height="470" style="display: block; margin-left: auto; margin-right: auto;" title="Webmin - Configuring FTP Server and Users/Groups" /></p>
<p style="text-align: justify;">You can see and edit the Denied FTP Users if you select the "<strong>Denied FTP Users</strong>":</p>
<p><img src="https://www.firewall.cx//images/stories/linux-webmin-23.jpg" alt="linux-webmin-23" width="639" height="377" style="display: block; margin-left: auto; margin-right: auto;" title="Webmin - Denied FTP Users" /></p>
<p style="text-align: justify;">Configuration file at <strong>/etc/proftpd.conf</strong> can be directly edited if you select the "<strong>Edit Config Files</strong>" in the main menu:</p>
<p><img src="https://www.firewall.cx//images/stories/linux-webmin-24.jpg" alt="linux-webmin-24" width="633" height="419" style="display: block; margin-left: auto; margin-right: auto;" /></p>
<h2 style="text-align: justify;">How To Schedule A Backup</h2>
<p style="text-align: justify;">Whatever the configuration files you would like to backup, schedule and restore, can be done from “<strong>Backup Configuration Files</strong>” under “<strong>Webmin</strong>”.</p>
<p style="text-align: justify;">In the “<strong>Backup Now</strong>” window, you can set the modules, the backup destination, and what you want included in the backup.&nbsp;&nbsp; The backup can be a local file on the system, a file on an FTP server, or a file on an SSH server. For both the servers, you will have to provide the username and password. Anything else that you would like to include during the backup such as webmin module configuration files, server configuration files, or other listed files can also be mentioned here:</p>
<p><img src="https://www.firewall.cx//images/stories/linux-webmin-25.jpg" alt="linux-webmin-25" width="639" height="463" style="display: block; margin-left: auto; margin-right: auto;" title="Webmin - How to Schedule a Backup" /></p>
<p style="text-align: justify;">If you want to schedule your Backups go to the next tab “<strong>Scheduled Backups</strong>” and select the “<strong>Add a new scheduled backup</strong>”, since, as shown, no scheduled backup has been defined yet:</p>
<p><img src="https://www.firewall.cx//images/stories/linux-webmin-26.jpg" alt="linux-webmin-26" width="639" height="384" style="display: block; margin-left: auto; margin-right: auto;" /></p>
<p style="text-align: justify;">&nbsp;</p>
<p><img src="https://www.firewall.cx//images/stories/linux-webmin-27.jpg" alt="linux-webmin-27" width="637" height="473" style="display: block; margin-left: auto; margin-right: auto;" title="Webmin - Create a scheduled backup" /></p>
<p style="text-align: justify;">And set the exact backup schedule options. The information is nearly same as that for the Backup Now. However, now you have the choice for setting the options for the schedule, such as Months, Weekdays, Days, Hours, Minutes and Seconds.</p>
<p><img src="https://www.firewall.cx//images/stories/linux-webmin-28.jpg" alt="linux-webmin-28" width="639" height="380" style="display: block; margin-left: auto; margin-right: auto;" /></p>
<p style="text-align: justify;">&nbsp;Restoration of modules can be selected from the “<strong>Restore Now</strong>” tab:</p>
<p><img src="https://www.firewall.cx//images/stories/linux-webmin-29.jpg" alt="linux-webmin-29" width="638" height="470" style="display: block; margin-left: auto; margin-right: auto;" /></p>
<p>The options for restore now follow the same pattern as for the backup. You have the options for restoring from a local file, an FTP server, an SSH server, and an uploaded file. Apart from providing the username and passwords for the servers, you have the option of only viewing what is going to be restored, without applying the changes.</p>
<h2>Configuring CRON Jobs With Webmin</h2>
<p style="text-align: justify;">Selecting the “<strong>Scheduled Cron Jobs</strong>” under “<strong>System</strong>” will allow creation, deletion, disabling and enabling of Cron jobs, as well as controlling user access to cron jobs. The interface also shows the users who are active and their current cron-jobs. The jobs can be selectively deleted, disabled or enabled (if disabled earlier).</p>
<p><img src="https://www.firewall.cx//images/stories/linux-webmin-30.jpg" alt="linux-webmin-30" width="637" height="412" style="display: block; margin-left: auto; margin-right: auto;" title="Configuring CRON Jobs with Webmin " /></p>
<p style="text-align: justify;">For creating a new cron job and scheduling it, select the tab “<strong>Create a new scheduled cron job</strong>”. You have the options of setting the Months, Weekdays, Days, Hours, Minutes. You have the option of running the job on any date, or running it only between two fixed dates:</p>
<p><img src="https://www.firewall.cx//images/stories/linux-webmin-31.jpg" alt="linux-webmin-31" width="641" height="469" style="display: block; margin-left: auto; margin-right: auto;" /></p>
<p style="text-align: justify;">For controlling access to Cron jobs, select the next tab “<strong>Control User Access to Cron Jobs</strong>” in the main menu:</p>
<p><img src="https://www.firewall.cx//images/stories/linux-webmin-32.jpg" alt="linux-webmin-32" width="638" height="396" style="display: block; margin-left: auto; margin-right: auto;" title="Webmin - Control User Access to Cron Jobs" /></p>
<h2 style="text-align: justify;">Configuring SSH Server With Webmin</h2>
<p style="text-align: justify;">Selecting “<strong>SSH Server</strong>” under “<strong>Servers</strong>” will allow all configuration of the SSH Server:</p>
<p><img src="https://www.firewall.cx//images/stories/linux-webmin-33.jpg" alt="linux-webmin-33" width="639" height="397" style="display: block; margin-left: auto; margin-right: auto;" title="Webmin - Configuring SSH Server with Webmin " /></p>
<p style="text-align: justify;">Access Control is provided by selecting the option "<strong>Access Control</strong>" from the main menu :</p>
<p><img src="https://www.firewall.cx//images/stories/linux-webmin-34.jpg" alt="linux-webmin-34" width="635" height="378" style="display: block; margin-left: auto; margin-right: auto;" /></p>
<p style="text-align: justify;">Miscellaneous options are available when the "<strong>Miscellaneous Options</strong>" is selected from the main menu:</p>
<p><img src="https://www.firewall.cx//images/stories/linux-webmin-35.jpg" alt="linux-webmin-35" width="635" height="412" style="display: block; margin-left: auto; margin-right: auto;" /></p>
<p style="text-align: justify;">The SSH config files can be accessed directly and edited by selecting “<strong>Edit Config Files</strong>” from the main menu.</p>
<p><img src="https://www.firewall.cx//images/stories/linux-webmin-36.jpg" alt="linux-webmin-36" width="635" height="404" style="display: block; margin-left: auto; margin-right: auto;" /></p>
<h2 style="text-align: justify;">Configuring Squid Proxy Server</h2>
<p style="text-align: justify;">Select “<strong>Squid Proxy Server</strong>” under “<strong>Servers</strong>”. The main menu shows what all can be controlled there:</p>
<p><img src="https://www.firewall.cx//images/stories/linux-webmin-37.jpg" alt="linux-webmin-37" width="643" height="442" style="display: block; margin-left: auto; margin-right: auto;" title="Webmin - Configuring Squid Proxy Server " /></p>
<p style="text-align: justify;">The Access Control allows ACL, Proxy restrictions, ICP restrictions, External ACL programs, and Reply proxy restrictions, when you select “<strong>Access Control</strong>”:</p>
<p><img src="https://www.firewall.cx//images/stories/linux-webmin-38.jpg" alt="linux-webmin-38" width="635" height="359" style="display: block; margin-left: auto; margin-right: auto;" title="webmin - Squid Access Control Settings" /></p>
<p style="text-align: justify;">&nbsp;</p>
<p><img src="https://www.firewall.cx//images/stories/linux-webmin-39.jpg" alt="linux-webmin-39" width="640" height="389" style="display: block; margin-left: auto; margin-right: auto;" /></p>
<h2 style="text-align: justify;">Configuring Apache HTTP Server</h2>
<p style="text-align: justify;">You can configure “<strong>Apache Webserver</strong>” under “<strong>Servers</strong>”. The main menu shows what you can configure there.</p>
<p style="text-align: justify;">All Global configuration can be done from the first tab:</p>
<p><img src="https://www.firewall.cx//images/stories/linux-webmin-40.jpg" alt="linux-webmin-40" width="641" height="379" style="display: block; margin-left: auto; margin-right: auto;" title="Webmin - Configuring Apache HTTP Server " /></p>
<p style="text-align: justify;">You can also configure the existing virtual hosts or create a virtual host, if you select the other tabs:</p>
<p><img src="https://www.firewall.cx//images/stories/linux-webmin-41.jpg" alt="linux-webmin-41" width="638" height="417" style="display: block; margin-left: auto; margin-right: auto;" /></p>
<p style="text-align: justify;"><strong>Users</strong> and <strong>Groups</strong> who are allowed to run Apache are mentioned here (select from the main menu):</p>
<p><img src="https://www.firewall.cx//images/stories/linux-webmin-42.jpg" alt="linux-webmin-42" width="641" height="406" style="display: block; margin-left: auto; margin-right: auto;" title="Webmin - apache user and group configuration" /></p>
<p style="text-align: justify;">Apache configuration files can be directly edited from the main menu.</p>
<p style="text-align: justify;">All the configuration files, <strong>httpd.conf</strong>, <strong>sarg.conf</strong>, <strong>squid.conf</strong>, and <strong>welcome.conf</strong> can be directly edited from this interface:</p>
<p><img src="https://www.firewall.cx//images/stories/linux-webmin-43.jpg" alt="linux-webmin-43" width="637" height="425" style="display: block; margin-left: auto; margin-right: auto;" /></p>
<p style="text-align: justify;">Any other service or application, which you are not able to locate directly from the index on the left, can be searched by entering in the search box on the left. If the item searched is not installed, Webmin will offer to download the RPM and install it. A corresponding entry will appear in the index on the left and you can proceed to configure the service or application. After installing an application or service, modules can be refreshed as well. From the Webmin interface, you can also view the module's logs.</p>]]></description>
			<category>Linux - Unix</category>
			<pubDate>Thu, 12 Jul 2012 15:00:00 +1000</pubDate>
		</item>
		<item>
			<title>Installing &amp; Configuring VSFTPD FTP Server for Redhat Enterprise Linux, CentOS &amp; Fedora</title>
			<link>https://www.firewall.cx/operating-systems/linux-unix/linux-vsftpd-setup-configure.html</link>
			<guid isPermaLink="true">https://www.firewall.cx/operating-systems/linux-unix/linux-vsftpd-setup-configure.html</guid>
			<description><![CDATA[<p style="text-align: justify;"><strong>Vsftpd</strong> is a popular <strong>FTP server</strong> for <strong>Unix/Linux systems</strong>. For thoes unaware of the <strong>vsftpd ftp server</strong>, note that this is not just another ftp server, but a mature product that has been around for over 12 years in the Unix world. While <strong>Vsftpd</strong> it is found as an installation option on many <strong>Linux distributions</strong>, it is not often Linux system administrators are seeking for <strong>installation and configuration</strong> instructions for it, which is the reason we decide to cover it on Firewall.cx.</p>
<p style="text-align: justify;">This article focuses on the installation and setup of the Vsftpd service on Linux Redhat Enterprise, Fedora and CentOS, however it is applicable to almost all other Linux distributions.&nbsp; We'll also take a look at a number of great tips which include setting quotas, restricting access to anonymous users, disabling uploads, setting a dedicated partition for the FTP service, configuring the system's IPTable firewall and much more.</p>
<h2>VSFTPD Features</h2>
<p style="text-align: justify;">Following is a list of vsftpd's features which confirms this small FTP package is capable of delivering a lot more than most FTP servers out there:</p>
<ul style="text-align: justify;">
<li>Virtual IP configurations</li>
<li>Virtual users</li>
<li>Standalone or inetd operation</li>
<li>Powerful per-user configurability</li>
<li>Bandwidth throttling</li>
<li>Per-source-IP configurability</li>
<li>Per-source-IP limits</li>
<li>IPv6</li>
<li>Encryption support through SSL integration</li>
<li>and much more....!</li>
</ul>
<h2>Installing The VSFTPD Linux Server</h2>
<p style="text-align: justify;">To initiate the installation of the vsftpd package, simply open your CLI prompt and use the yum command (you need root privileges) as shown below:</p>
<div class="box-content" style="text-align: justify;"># <strong>yum install vsftpd</strong></div>
<p style="text-align: justify;">Yum will automatically locate, download and install the latest vsftpd version.</p>
<h2 style="text-align: justify;">Configure VSFTPD Server</h2>
<p style="text-align: justify;">To open the configuration file, type:</p>
<div class="box-content" style="text-align: justify;"># <strong>vi /etc/vsftpd/vsftpd.conf</strong></div>
<p style="text-align: justify;">Turn off standard ftpd xferlog log format and turn on verbose vsftpd log format by making the following changes in the vsftpd.conf file:</p>
<div class="box-content" style="text-align: justify;">xferlog_std_format=NO<br />log_ftp_protocol=YES</div>
<div style="text-align: justify;">Note: the default vsftpd log file is <strong>/var/log/vsftpd.log</strong>.</div>
<p style="text-align: justify;">Above two directives will enable logging of all FTP transactions.</p>
<p style="text-align: justify;">To lock down users to their home directories:</p>
<div class="box-content" style="text-align: justify;">chroot_local_user=YES</div>
<p style="text-align: justify;">You can create warning banners for all FTP users, by defining the path:</p>
<div class="box-content" style="text-align: justify;">banner_file=/etc/vsftpd/issue</div>
<p style="text-align: justify;">Now you can create the <strong>/etc/vsftpd/issue</strong> file with a message compliant with the local site policy or a legal disclaimer:</p>
<div class="box-content" style="text-align: justify;">“NOTICE TO USERS - Use of this system constitutes consent to security monitoring and testing. All activity is logged with your host name and IP address”.</div>
<h2>Turn On VFSTPD Service</h2>
<p style="text-align: justify;">Turn on vsftpd on boot:</p>
<div class="box-content" style="text-align: justify;"># <strong>systemctl enable vsftpd@.service</strong></div>
<p style="text-align: justify;">Start the service:</p>
<div class="box-content" style="text-align: justify;"># <strong>systemctl start vsftpd@vsftpd.service</strong></div>
<p style="text-align: justify;">You can verify the service is running and listening on the correct port using the following command:</p>
<div class="box-content" style="text-align: justify;"># <strong>netstat -tulpn | grep :21</strong></div>
<p style="text-align: justify;">Here's the expected output:</p>
<div class="box-content" style="text-align: justify;">tcp&nbsp;&nbsp; 0&nbsp; 0 0.0.0.0:21&nbsp; 0.0.0.0:*&nbsp;&nbsp; LISTEN&nbsp;&nbsp; LISTEN 9734/vsftpd</div>
<h2 style="text-align: justify;">Configure IPtables To Protect The FTP Server</h2>
<p style="text-align: justify;">In case IPTables are configured on the system, it will be necessary to edit the iptables file and open the ports used by FTP to ensure the service's operation.</p>
<p style="text-align: justify;">To open file <strong>/etc/sysconfig/iptables</strong>, enter:</p>
<div class="box-content" style="text-align: justify;"># <strong>vi /etc/sysconfig/iptables</strong></div>
<p style="text-align: justify;">Add the following lines, ensuring that they appear before the final LOG and DROP lines for the RH-Firewall-1-INPUT:</p>
<div class="box-content">-A RH-Firewall-1-INPUT -m state --state NEW -p tcp --dport 21 -j ACCEPT</div>
<p style="text-align: justify;">Next, open file <strong>/etc/sysconfig/iptables-config</strong>, and enter:</p>
<div class="box-content" style="text-align: justify;"># <strong>vi /etc/sysconfig/iptables-config</strong></div>
<p style="text-align: justify;">Ensure that the space-separated list of modules contains the FTP connection-tracking module:</p>
<div class="box-content" style="text-align: justify;">IPTABLES_MODULES="ip_conntrack_ftp"</div>
<p style="text-align: justify;">Save and close the file and finally restart the firewall using the following commands:</p>
<div class="box-content" style="text-align: justify;"># <strong>systemctl restart iptables.service</strong><br /># <strong>systemctl restart ip6tables.service</strong></div>
<h2 style="text-align: justify;">Tip: View FTP Log File</h2>
<p style="text-align: justify;">Type the following command:</p>
<div class="box-content" style="text-align: justify;"># <strong>tail -f /var/log/vsftpd.log</strong></div>
<h2>Tip: Restricting Access to Anonymous User Only</h2>
<p style="text-align: justify;">Edit the vsftpd configuration file <strong>/etc/vsftpd/vsftpd.conf</strong> and add the following:</p>
<div class="box-content" style="text-align: justify;">local_enable=NO</div>
<h2>Tip: To Disable FTP Uploads</h2>
<p style="text-align: justify;">Edit the vsftpd configuration file <strong>/etc/vsftpd/vsftpd.conf</strong> and add the following:</p>
<div class="box-content" style="text-align: justify;">write_enable=NO</div>
<h2 style="text-align: justify;">Tip: To Enable Disk Quota</h2>
<p style="text-align: justify;">Disk quota must be enabled to prevent users from filling a disk used by FTP upload services. Edit the vsftpd configuration file. Add or correct the following configuration options to represents a directory which vsftpd will try to change into after an anonymous login:</p>
<div class="box-content" style="text-align: justify;">anon_root=/ftp/ftp/pub</div>
<p style="text-align: justify;">The ftp users are the same users as those on the hosting machine.</p>
<p style="text-align: justify;">You could have a separate group for ftp users, to help keep their privileges down (for example 'anonftpusers'). Knowing that, your script should do:</p>
<div class="box-content" style="text-align: justify;"><strong>useradd -d /www/htdocs/hosted/bob -g anonftpusers -s /sbin/nologin bob</strong><br />
<div>echo bobspassword | passwd --stdin bob</div>
<div>echo bob &gt;&gt; /etc/vsftpd/user_list</div>
</div>
<p style="text-align: justify;">Be extremely careful with your scripts, as they will have to be run as <strong>root</strong>.</p>
<p style="text-align: justify;">However, for this to work you will have to have the following options enabled in<strong> /etc/vsftpd/vsftpd.conf</strong>:&nbsp;</p>
<div class="box-content" style="text-align: justify;">userlist_enable=YES<br />userlist_deny=NO</div>
<h2>Security Tip: Place The FTP Directory On Its Own Partition</h2>
<p style="text-align: justify;">Separation of the operating system files from FTP users files may result into a better and secure system. Restricting the growth of certain file systems is possible using various techniques. For example, use /ftp partition to store all ftp home directories and mount ftp with nosuid, nodev and noexec options. A sample <strong>/etc/fstab</strong> entry:</p>
<div class="box-content" style="text-align: justify;">/dev/sda5&nbsp; /ftp&nbsp; ext3&nbsp; defaults,nosuid,nodev,noexec,usrquota 1 2</div>
<h2>Example File For vsftpd.conf</h2>
<p style="text-align: justify;">Following is an example for <strong>vsftpd.conf</strong>. It allows the users listed in the user_list file to log in, no anonymous users, and quite tight restrictions on what users can do:</p>
<div class="box-content" style="text-align: justify;"># Allow anonymous FTP?<br />
<div>anonymous_enable=NO</div>
<div>#</div>
<div># Allow local users to log in?</div>
<div>local_enable=YES</div>
<div>#</div>
<div># Allow any form of FTP write command.</div>
<div>write_enable=YES</div>
<div>#</div>
<div># To make files uploaded by your users writable by only</div>
<div># themselves, but readable by everyone and if, through some</div>
<div># misconfiguration, an anonymous user manages to upload a file, # the file will have no read, write or execute permission. Just to be # safe.&nbsp;</div>
<div>local_umask=0000</div>
<div>file_open_mode=0644</div>
<div>anon_umask=0777</div>
<div>#</div>
<div># Allow the anonymous FTP user to upload files?</div>
<div>anon_upload_enable=NO</div>
<div>#</div>
<div># Activate directory messages - messages given to remote users when they</div>
<div># go into a certain directory.</div>
<div>dirmessage_enable=NO</div>
<div>#</div>
<div># Activate logging of uploads/downloads?</div>
<div>xferlog_enable=YES</div>
<div>#</div>
<div># Make sure PORT transfer connections originate from port 20 (ftp-data)?</div>
<div>connect_from_port_20=YES</div>
<div>#</div>
<div># Log file in standard ftpd xferlog format?</div>
<div>xferlog_std_format=NO</div>
<div>#</div>
<div># User for vsftpd to run as?</div>
<div>nopriv_user=vsftpd</div>
<div>#</div>
<div># Login banner string:</div>
<div>ftpd_banner= NOTICE TO USERS - Use of this system constitutes consent to security monitoring and testing. All activity is logged with your host name and IP address.</div>
<div>#</div>
<div># chroot local users (only allow users to see their directory)?</div>
<div>chroot_local_user=YES</div>
<div>#</div>
<div># PAM service name?</div>
<div>pam_service_name=vsftpd</div>
<div>#</div>
<div># Enable user_list (see next option)?</div>
<div>userlist_enable=YES</div>
<div>#</div>
<div># Should the user_list file specify users to deny(=YES) or to allow(=NO)</div>
<div>userlist_deny=NO</div>
<div>#</div>
<div># Standalone (not run through xinetd) listen mode?</div>
<div>listen=YES</div>
<div>#</div>
<div>#</div>
<div>tcp_wrappers=NO</div>
<div>#</div>
<div># Log all ftp actions (not just transfers)?</div>
<div>log_ftp_protocol=YES</div>
<div># Initially YES for trouble shooting, later change to NO</div>
<div>#</div>
<div># Show file ownership as ftp:ftp instead of real users?</div>
<div>hide_ids=YES</div>
<div>#</div>
<div># Allow ftp users to change permissions of files?</div>
<div>chmod_enable=NO</div>
<div>#</div>
<div># Use local time?</div>
<div>use_localtime=YES</div>
<div>#</div>
<div># List of raw FTP commands, which are allowed (some commands may be a security hazard):</div>
<div>cmds_allowed=ABOR,QUIT,LIST,PASV,RETR,CWD,STOR,TYPE,PWD,SIZE,NLST,PORT,SYST,PRET,MDTM,DEL,MKD,RMD</div>
</div>
<p>With this config, uploaded files are not readable or executable by anyone, so the server is acting as a '<strong>dropbox</strong>'. Change the <em>file_open_mode</em>option to change that.</p>
<p style="text-align: justify;">Lastly, it is also advised to have a look at '<strong>man vsftpd.conf</strong>' for a full list and description of all options.</p>]]></description>
			<category>Linux - Unix</category>
			<pubDate>Mon, 04 Jun 2012 07:00:00 +1000</pubDate>
		</item>
		<item>
			<title>Updating Your Linux Server - How to Update Linux Workstations and Operating Systems</title>
			<link>https://www.firewall.cx/operating-systems/linux-unix/linux-updating-server-workstation.html</link>
			<guid isPermaLink="true">https://www.firewall.cx/operating-systems/linux-unix/linux-updating-server-workstation.html</guid>
			<description><![CDATA[<p style="text-align: justify;">Like any other software, an operating system needs to be updated. Updates are required not only because of the new hardware coming into the market, but also for improving the overall performance and taking care of security issues.</p>
<p style="text-align: justify;">Updates are usually done in two distinct ways. One is called the incremental update, and the other is the major update. In the incremental updates, components of the operating system undergo minor modifications. Such modifications are usually informed to users over the net. Users can download and install the modifications serially using the update managing software.</p>
<p style="text-align: justify;">However, some major modifications require so many changes involving several packages simultaneously, it becomes rather complicated to accomplish serially over the net. This type of modification is best done by a fresh installation, after acquiring the improved version of the operating system.</p>
<p style="text-align: justify;">Package management is one of the most distinctive features distinguishing major Linux distributions. Major projects offer a graphical user interface where users can select a package and install it with a mouse click. These programs are front-ends to the low-level utilities to manage the tasks associated with installing packages on a Linux system. Although many desktop Linux users feel comfortable installing packages through these GUI tools, the command-line package management offers two excellent features not available in any graphical package management utility, and that is power and speed.</p>
<p style="text-align: justify;">The Linux world is sharply divided into three major groups, each swearing by the type of package management they use - the “RPM” group, the “DEB” group and the “Slackware” group. There are other fragment groups using different package management types, but they are insignificantly minor in comparison. Among the three groups, RPM and DEB are by far the most popular and several other groups have been derived from them. Some of the Linux distributions that handle these package managements are:</p>
<p style="text-align: justify;"><strong>RPM</strong> - RedHat Enterprise/Fedora/CentOS/OpenSUSE/Mandriva, etc.</p>
<p style="text-align: justify;"><strong>DEB </strong>- Debian/Ubuntu/Mint/Knoppix, etc.</p>
<h2>RPM - RedHat Package Manager</h2>
<p style="text-align: justify;">Although RPM was originally used by RedHat, this package management is handled by different types of package management tools specific to each Linux distribution. While <strong>OpenSUSE </strong>uses the “<strong>zypp</strong>” package management utility, <strong>RedHat Enterprise Linux (REL)</strong>, <strong>Fedora </strong>and <strong>CentOS </strong>use “<strong>yum</strong>”, and <strong>Mandriva </strong>and <strong>Mageia </strong>use “<strong>urpmi</strong>”.</p>
<p style="text-align: justify;">Therefore, if you are an <strong>OpenSUSE </strong>user, you will use the following commands:</p>
<p style="text-align: justify;">For updating your package list: <strong>zypper refresh</strong></p>
<p style="text-align: justify;">For upgrading your system: <strong>zypper update</strong></p>
<p style="text-align: justify;">For installing new software<em> pkg</em>: <strong>zypper install <em>pkg</em></strong> (from package repository)</p>
<p style="text-align: justify;">For installing new software <em>pkg</em>: <strong>zypper install <em>pkg</em>&nbsp;</strong> (from package file)</p>
<p style="text-align: justify;">For updating existing software <em>pkg: </em><strong>zypper update -t package <em>pkg</em></strong></p>
<p style="text-align: justify;">For removing unwanted software <em>pkg</em>: <strong>zypper remove<em> pkg</em></strong></p>
<p style="text-align: justify;">For listing installed packages: <strong>zypper search -ls</strong></p>
<p style="text-align: justify;">For searching by <em>file</em> name: <strong>zypper wp <em>file</em></strong></p>
<p style="text-align: justify;">For searching by <em>pattern</em>: <strong>zypper search -t pattern<em> pattern</em></strong></p>
<p style="text-align: justify;">For searching by package name <em>pkg: </em><strong>zypper search <em>pkg</em></strong></p>
<p style="text-align: justify;">For listing repositories: <strong>zypper repos</strong></p>
<p style="text-align: justify;">For adding a repository: <strong>zypper addrepo <em>pathname</em></strong></p>
<p style="text-align: justify;">For removing a repository: <strong>zypper removerepo <em>name</em></strong></p>
<p>&nbsp;</p>
<p style="text-align: justify;">If you are a <strong>Fedora </strong>or <strong>CentOS </strong>user, you will be using the following commands:</p>
<p style="text-align: justify;">For updating your package list: <strong>yum check-update</strong></p>
<p style="text-align: justify;">For upgrading your system: <strong>yum update</strong></p>
<p style="text-align: justify;">For installing new software<em> pkg</em>: <strong>yum install <em>pkg</em></strong> (from package repository)</p>
<p style="text-align: justify;">For installing new software <em>pkg: </em><strong>yum localinstall <em>pkg</em></strong> (from package file)</p>
<p style="text-align: justify;">For updating existing software <em>pkg</em>: <strong>yum update <em>pkg</em></strong></p>
<p style="text-align: justify;">For removing unwanted software <em>pkg: </em><strong>yum erase<em> pkg</em></strong></p>
<p style="text-align: justify;">For listing installed packages: <strong>rpm -qa</strong></p>
<p style="text-align: justify;">For searching by <em>file</em> name: <strong>yum provides <em>file</em></strong></p>
<p style="text-align: justify;">For searching by <em>pattern: </em><strong>yum search <em>pattern</em></strong></p>
<p style="text-align: justify;">For searching by package name <em>pkg</em>: <strong>yum list <em>pkg</em></strong></p>
<p style="text-align: justify;">For listing repositories: <strong>yum repolist</strong></p>
<p style="text-align: justify;">For adding a repository: (add repo to <strong>/etc/yum.repos.d/</strong>)</p>
<p style="text-align: justify;">For removing a repository: (remove repo from<strong><em> </em>/etc/yum.repos.d/</strong>)</p>
<p style="text-align: justify;">&nbsp;</p>
<p style="text-align: justify;">You may be a <strong>Mandriva </strong>or <strong>Mageia </strong>user, in which case, the commands you will use will be:</p>
<p style="text-align: justify;">For updating your package list: <strong>urpmi update -a</strong></p>
<p style="text-align: justify;">For upgrading your system: <strong>urpmi --auto-select</strong></p>
<p style="text-align: justify;">For installing new software<em> pkg: </em><strong>urpmi <em>pkg</em></strong> (from package repository)</p>
<p style="text-align: justify;">For installing new software <em>pkg</em>: <strong>urpmi <em>pkg</em></strong> (from package file)</p>
<p style="text-align: justify;">For updating existing software <em>pkg</em>: <strong>urpmi <em>pkg</em></strong></p>
<p style="text-align: justify;">For removing unwanted software <em>pkg: </em><strong>urpme<em> pkg</em></strong></p>
<p style="text-align: justify;">For listing installed packages: <strong>rpm -qa</strong></p>
<p style="text-align: justify;">For searching by <em>file</em> name:<strong> urpmf <em>file</em></strong></p>
<p style="text-align: justify;">For searching by <em>pattern: </em><strong>urpmq --fuzzy <em>pattern</em></strong></p>
<p style="text-align: justify;">For searching by package name <em>pkg</em>: <strong>urpmq <em>pkg</em></strong></p>
<p style="text-align: justify;">For listing repositories: <strong>urpmq --list-media</strong></p>
<p style="text-align: justify;">For adding a repository: <strong>urpmi.addmedia <em>name path</em></strong></p>
<p style="text-align: justify;">For removing a repository: <strong>urpmi.removemedia <em>media</em></strong></p>
<h2 style="text-align: justify;">DEB - Debian Package Manager</h2>
<p style="text-align: justify;">Debian Package Manager was introduced by Debian and later adopted by all derivatives of Debian - Ubuntu, Mint, Knoppix, etc. This is a relatively simple and standardized set of tools, working across all the Debian derivatives. Therefore, if you use any of the distributions managed by the DEB package manager, you will be using the following commands:</p>
<p style="text-align: justify;">For updating your package list: <strong>apt-get update</strong></p>
<p style="text-align: justify;">For upgrading your system: <strong>apt-get upgrade</strong></p>
<p style="text-align: justify;">For installing new software<em> pkg</em>: <strong>apt-get install <em>pkg</em></strong> (from package repository)</p>
<p style="text-align: justify;">For installing new software <em>pkg</em>: <strong>dpkg -i <em>pkg</em></strong> (from package file)</p>
<p style="text-align: justify;">For updating existing software <em>pkg</em>: <strong>apt-get install<em> pkg</em></strong></p>
<p style="text-align: justify;">For removing unwanted software <em>pkg</em>: <strong>apt-get remove<em> pkg</em></strong></p>
<p style="text-align: justify;">For listing installed package: <strong>dpkg -l</strong></p>
<p style="text-align: justify;">For searching by <em>file</em> name: <strong>apt-file search <em>path</em></strong></p>
<p style="text-align: justify;">For searching by <em>pattern</em>: <strong>apt-cache search <em>pattern</em></strong></p>
<p style="text-align: justify;">For searching by package name <em>pkg</em><em></em>: <strong>apt-cache search <em>pkg</em></strong></p>
<p style="text-align: justify;">For listing repositories<em></em>: <strong>cat /etc/apt/sources.list</strong></p>
<p style="text-align: justify;">For adding a repository<em></em>: (<strong>edit /etc/apt/sources.list</strong>)</p>
<p style="text-align: justify;">For removing a repository<em></em>: (<strong>edit /etc/apt/sources.list</strong>)</p>]]></description>
			<category>Linux - Unix</category>
			<pubDate>Thu, 29 Mar 2012 07:58:04 +1100</pubDate>
		</item>
		<item>
			<title>Implementing Virtual Servers and Load Balancing Cluster System with Linux</title>
			<link>https://www.firewall.cx/operating-systems/linux-unix/linux-services-virtual-servers.html</link>
			<guid isPermaLink="true">https://www.firewall.cx/operating-systems/linux-unix/linux-services-virtual-servers.html</guid>
			<description><![CDATA[<div>
<h2>What is Server Virtualization?</h2>
</div>
<p style="text-align: justify;">Server virtualization is the process of apportioning a physical server into several smaller virtual servers. During server virtualization, the resources of the server itself remain hidden. In fact, the resources are masked from users, and software is used for dividing the physical server into multiple virtual machines or environments, called virtual or private servers.</p>
<p style="text-align: justify;">This technology is commonly used in Web servers. Virtual Web servers provide a very simple and popular way of offering low-cost web hosting services. Instead of using a separate computer for each server, dozens of virtual servers can co-exist on the same computer.</p>
<p style="text-align: justify;">There are many benefits of server virtualization. For example, it allows each virtual server to run its own operating system. Each virtual server can be independently rebooted without disturbing the others. Because several servers run on the same hardware, less hardware is required for server virtualization, which saves a lot of money for the business. Since the process utilizes resources to the fullest, it saves on operational costs. Using a lower number of physical servers also reduces hardware maintenance.</p>
<p style="text-align: justify;">In most cases, the customer does not observe any performance deficit and each web site behaves as if it is being served by a dedicated server. However, the resources of the computer being shared, if a large number of virtual servers reside on the same computer, or if one of the virtual servers starts to hog the resources, Web pages will be delivered more slowly.</p>
<p style="text-align: justify;">There are several ways of creating virtual servers, with the most common being virtual machines, operating system-level virtualization, and paravirtual machines.</p>
<h2>How Are Virtual Servers Helpful</h2>
<p style="text-align: justify;">The way Internet is exploding with information, it is playing an increasingly important role in our lives. Internet traffic is increasing dramatically, and has been growing at an annual rate of nearly 100%. The workload on the servers is simultaneously increasing significantly so that servers frequently become overloaded for short durations, especially for popular web sites.</p>
<p style="text-align: justify;">To overcome the overloading problem of the servers, there are two solutions. You could have a single server solution, such as upgrading the server to a higher performance server. However, as requests increase, it will soon be overloaded, so that it has to be upgraded repeatedly. The upgrading process is complex and the cost is high.</p>
<p style="text-align: justify;">The other is the multiple server solution, such as building a scalable network service system on a cluster of servers. As load increases, you can just add a new server or several new servers into the cluster to meet the increasing requests, and a virtual server running on commodity hardware offers the lowest cost to performance ratio. Therefore, for network services, the virtual server is a highly scalable and more cost-effective for building server cluster system.</p>
<h2>Virtual Servers with Linux</h2>
<p style="text-align: justify;">Highly available server solutions are done by clustering. Cluster computing involves three distinct branches, of which two are addressed by RHEL or Red Hat Enterprise Linux:</p>
<p style="text-align: justify;"><strong>Ø</strong>&nbsp;&nbsp;&nbsp; Load balancing clusters using Linux Virtual Servers as specialized routing machines to dispatch traffic to a pool of servers.</p>
<p style="text-align: justify;"><strong>Ø</strong>&nbsp;&nbsp;&nbsp; Highly available or HA Clustering with Red Hat Cluster Manager that uses multiple machines to add an extra level of reliability for a group of services.</p>
<h2>Load Balancing Cluster System Using RHEL Virtual Servers</h2>
<p style="text-align: justify;">When you access a website or a database application, you do not know if you are accessing a single server or a group of servers. To you, the <strong>Linux Virtual Server</strong> or <strong>LVS cluster</strong> appears as a single server. In reality, there is a cluster of two or more servers behind a pair or <strong>redundant LVS routers</strong>. These routers distribute the client requests evenly throughout the cluster system.</p>
<p style="text-align: justify;">Administrators use Red Hat Enterprise Linux and commodity hardware to address availability requirements, and to create consistent and continuous access to all hosted services.</p>
<p style="text-align: justify;">In its simplest form, an LVS cluster consists of two layers. In the first layer are two similarly configured cluster members, which are Linux machines. One of these machines is the LVS router and is configured to direct the requests from the internet to the servers. The LVS router balances the load on the real servers, which form the second layer. The real servers provide the critical services to the end-user. The second Linux machine acts as a monitor to the active router and assumes its role in the event of a failure.</p>
<p style="text-align: justify;">The active router directs traffic from the internet to the real servers by making use of Network Address Translation or NAT. The real servers are connected to a dedicated network segment transfer all public traffic via the active LVS router. The outside world sees this entire cluster arrangement as a single entity.</p>
<h2>LVS with NAT Routing</h2>
<p style="text-align: justify;">The active LVS router has two Network Interface Cards or NICs. One of the NICs is connected to the Internet and has a real IP address on the eth0 and a floating IP address aliased to eth0:1. The other NIC connects to the private network with a real IP address on the eth1, and a floating address aliased to eth1:1.</p>
<p style="text-align: justify;">All the servers of the cluster are located on the private network and use the floating IP for the NAT router. They communicate with the active LVS router via the floating IP as their default route. This ensures their abilities for responding to requests from the inernet are not impaired.</p>
<p style="text-align: justify;">When requests are received by the active LVS router, it routes the request to an appropriate server. The real server processes the request and returns the packets to the LVS router. Using NAT, the LVS router then replaces the address of the real server in the packets with the public IP address of the LVS router. This process is called IP Masquerading, and it hides the IP addresses of the real servers from the requesting clients.</p>
<h2>Configuring LVS Routers with the Piranha Configuration Tool</h2>
<p style="text-align: justify;">The configuration file for an LVS cluster follows strict formatting rules. To prevent server failures because of syntax errors in the file lvs.cf, using the Piranha Configuration Tool is highly recommended. This tool provides a structured approach to creating the necessary configuration file for a Piranha cluster. The configuration file is located at <strong>/etc/sysconfig/ha/lvs.cf</strong>, and the configuration can be done with a web-based tool such as the Apache HTTP Server.</p>
<p>As an example, we will use the following settings:</p>
<div class="info"><em><em>LVS Router 1: eth0: 192.168.26.201<br /></em></em>
<p><em>LVS Router 2: eth0: 192.168.26.202</em></p>
<p><em>Real Server 1: eth0: 192.168.26.211</em></p>
<p><em>Real Server 2: eth0: 192.168.26.212</em></p>
<p><em>VIP: 192.168.26.200</em></p>
<p><em>Gateway: 192.168.26.1</em></p>
<em></em></div>
<p>You will need to install piranha and ipvsadm packages on the LVS Routers:</p>
<div class="box-content"># <strong>yum install ipvsadm</strong><br /><br /># <strong>yum install piranha</strong></div>
<p>Start services on the LVS Routers with:</p>
<div class="box-content"># <strong>chkconfig pulse on</strong><br />
<p># <strong>chkconfig piranha-gui on</strong></p>
<p># <strong>chkconfig httpd on</strong></p>
</div>
<p>Set a Password for the Piranha Configuration Tool using the following commands:&nbsp;</p>
<p class="box-content"># <strong>piranha-passwd</strong></p>
<p>Next, turn on Packet Forwarding on the LVS Routers with:</p>
<div class="box-content">#<strong> echo 1 &gt; /proc/sys/net/ipv4/ip_forward</strong></div>
<h2>Starting the Piranha Configuration Tool Service</h2>
<p>First you'll need to modify the mode <strong>SELinux</strong> in <strong>permissive mode</strong> with the use of the command:</p>
<div class="box-content"># <strong>setenforce 0</strong><br />
<p># <strong>service httpd start</strong></p>
<p># <strong>service piranha-gui start</strong></p>
</div>
<p style="text-align: justify;">If this is not done, the system will most probably show the following error massage when the piranha-gui service is started:</p>
<div><em class="box-content">Starting piranha-gui: (13)Permission denied: make_sock: could not bind to address [::]:3636<br /><br /><em>(13)Permission denied: make_sock: could not bind to address 0.0.0.0:3636</em><br /><em>No listening sockets available, shutting down </em><br /><em>Unable to open logs</em><br /> </em></div>
<h2>Configure the LVS Routers with the Piranha Configuration Tool</h2>
<p style="text-align: justify;">The Piranha Configuration Tool runs on port 3636 by default. Open <strong>http://localhost:3626</strong> or <strong>http://192.168.26.201:3636</strong> in a Web browser to access the Piranha Configuration Tool. Click on the <strong>Login </strong>button and enter piranha for the Username and the administrative password you created, in the Password field:</p>
<p><img src="https://www.firewall.cx/images/stories/linux-virtual-servers-1.gif" alt="linux-virtual-servers-1" width="564" height="323" style="display: block; margin-left: auto; margin-right: auto;" /></p>
<p><strong>Click</strong> on the <strong>GLOBAL SETTINGS</strong> panel, enter the primary server public IP, and click the <strong>ACCEPT </strong>button:</p>
<p><img src="https://www.firewall.cx/images/stories/linux-virtual-servers-2.gif" alt="linux-virtual-servers-2" width="567" height="265" style="display: block; margin-left: auto; margin-right: auto;" /></p>
<p>&nbsp;Click on the <strong>REDUNDANCY </strong>panel, enter the redundant server public IP, and click the <strong>ACCEPT </strong>button:</p>
<p><img src="https://www.firewall.cx/images/stories/linux-virtual-servers-3.gif" alt="linux-virtual-servers-3" width="569" height="251" style="display: block; margin-left: auto; margin-right: auto;" /></p>
<p>&nbsp;<strong>Click</strong> on the <strong>VIRTUAL SERVERS</strong> panel, add a server, edit it, and <strong>activate </strong>it:</p>
<p><img src="https://www.firewall.cx/images/stories/linux-virtual-servers-4.gif" alt="linux-virtual-servers-4" width="565" height="270" style="display: block; margin-left: auto; margin-right: auto;" /></p>
<p><img src="https://www.firewall.cx/images/stories/linux-virtual-servers-5.gif" alt="linux-virtual-servers-5" width="565" height="419" style="display: block; margin-left: auto; margin-right: auto;" /></p>
<p style="text-align: justify;">Clicking on the <strong>REAL SERVER</strong> subsection link at the top of the panel displays the <strong>EDIT REAL SERVER </strong>subsection. Click the <strong>ADD </strong>button to add new servers, edit them and activate them:</p>
<p><img src="https://www.firewall.cx/images/stories/linux-virtual-servers-6.gif" alt="linux-virtual-servers-6" width="566" height="223" style="display: block; margin-left: auto; margin-right: auto;" /></p>
<p>Copy the <strong>lvs.cf</strong> file to another LVS router:</p>
<div class="box-content"># <strong>scp /etc/sysconfig/ha/lvs.cf root@192.168.26.202:/etc/sysconfig/ha/lvs.cf</strong></div>
<p>Start the pulse services on the LVS Routers with the following command:</p>
<div class="box-content"># <strong>service pulse restart</strong></div>
<h2>Testing the System</h2>
<p>You can use the Apache HTTP server benchmarking tool (ab) to simulate a visit by the user.</p>
<h2>HA Clustering With Red Hat Cluster Manager</h2>
<p style="text-align: justify;">When dealing with clusters, single point failures, unresponsive applications and nodes are some of the issues that increase the non-availability of the servers. Red Hat addresses these issues through their High Availability or HA Add-On servers. Centralised configurations and management are some of the best features of the <strong>Conga </strong>application of RHEL.</p>
<p style="text-align: justify;">For delivering an extremely mature, high-performing, secure and lightweight high-availability server solution, RHEL implements the Totem Single Ring Ordering and Membership Protocol. <strong>Corosync </strong>is the cluster executive within the HA Add-On.</p>
<h2>Kernel-based Virtual Machine Technology</h2>
<p style="text-align: justify;">RHEL uses the Linux kernel that has the virtualization characteristics built-in and makes use of the kernel-based virtual machine technology known as KVM. This makes RHEL perfectly suitable to run as either a host or a guest in any Enterprise Linux deployment. As a result, all Red Hat Enterprise Linux system management and security tools and certifications are part of the kernel and always available to the administrators, out of the box.</p>
<p style="text-align: justify;">RHEL uses highly improved <strong>SCSI-3 PR</strong> reservations-based fencing. Fencing is the process for removing resources from the cluster node from being accessed when they have lost contact with the cluster. This prevents uncoordinated modification of shared storage thus protecting the resources.</p>
<p style="text-align: justify;">Improvement in system flexibility and configuration is possible because RHEL allows manual specification of devices and keys for reservation and registration. Ordinarily, after fencing, the unconnected cluster mode would need to be rebooted to rejoin the cluster. RHEL unfencing makes it possible to re-enable access and startup of the node without administrative intervention.</p>
<h2>Improved Cluster Configuration</h2>
<p style="text-align: justify;">LDAP, the Lightweight Directory Access Protocol provides improved cluster configuration system for load options. This provides better manageability and usability across the cluster by easily configuring, validating and synchronizing the reload. <strong>Virtualized KVM</strong> guests can be run as managed services.</p>
<p style="text-align: justify;">RHEL Web interface to the cluster management and administration runs on <strong>TurboGears2 </strong>and provides a rich graphical user interface. This enables unified logging and debugging by administrators who can enable, capture and read cluster system logs using a single cluster configuration command.</p>
<h2>Installing TurboGears2</h2>
<p style="text-align: justify;">The method of installing <strong>TurboGears2 </strong>depends on the platform and the level of experience. It is recommended to install TurboGears2 withing a virtual enviroment as this will prevent interference with the system's installed packages. Prerequisites for installation of <strong>TurboGears2 </strong>are <strong>Python</strong>, <strong>Setuptools</strong>, <strong>Database </strong>and <strong>Drivers</strong>, <strong>Virtualenv</strong>, <strong>Virtualenvwrapper </strong>and other dependencies.</p>
<p><img src="https://www.firewall.cx/images/stories/linux-virtual-servers-7.gif" alt="linux-virtual-servers-7" width="539" height="488" style="display: block; margin-left: auto; margin-right: auto;" /></p>]]></description>
			<category>Linux - Unix</category>
			<pubDate>Mon, 26 Mar 2012 08:00:00 +1100</pubDate>
		</item>
		<item>
			<title>Working with Linux TCP/IP Network Configuration Files</title>
			<link>https://www.firewall.cx/operating-systems/linux-unix/linux-services-tcpip.html</link>
			<guid isPermaLink="true">https://www.firewall.cx/operating-systems/linux-unix/linux-services-tcpip.html</guid>
			<description><![CDATA[<p style="text-align: justify;">This article covers the main TCP/IP network configuration files used by Linux to configure various network services of the system such as IP Address, Default Gateway, Name servers - DNS, hostname and much more.&nbsp; Any Linux Administrator must be well aware where these services are configured and to use them. The good news is that most of the information provided on this article apply's to Redhat Fedora, Enterprise Linux, CentOS, Ubunto and other similar Linux distributions.</p>
<p style="text-align: justify;">On most Linux systems, you can access the TCP/IP connection details within '<strong>X Windows</strong>' from <strong>Applications &gt; Others &gt; Network Connections</strong>. The same may also be reached through <strong>Application &gt; System Settings &gt; Network &gt; Configure</strong>. This opens up a window, which offers configuration of IP parameters for wired, wireless, mobile broadband, VPN and DSL connections:</p>
<p><img src="https://www.firewall.cx/images/stories/linux-tcpip-config-1.gif" alt="linux-tcpip-config-1" width="427" height="388" style="display: block; margin-left: auto; margin-right: auto;" /></p>
<p>The values entered here modify the files:</p>
<p><strong>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /etc/sysconfig/network-scripts/ifcfg-eth0</strong></p>
<p><strong>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /etc/sysconfig/networking/devices/ifcfg-eth0</strong></p>
<p><strong>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /etc/resolv.conf</strong></p>
<p><strong>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /etc/hosts</strong></p>
<p>The static host IP assignment is saved in <strong>/etc/hosts</strong></p>
<p>The DNS server assignments are saved in the <strong>/etc/resolv.conf</strong></p>
<p>IP assignments for all the devices found on the system are saved in the <strong>ifcfg-&lt;<em>interface</em>&gt;</strong> files mentioned above.</p>
<p>If you want to see all the IP assignments, you can run the command for interface configuration:</p>
<div class="box-content"># <strong>ifconfig</strong></div>
<p>Following is the output of the above command:</p>
<p class="box-content">[root@gateway ~]<strong># ifconfig<br /><br /></strong>eth0 &nbsp;&nbsp; Link encap:Ethernet&nbsp; HWaddr 00:0C:29:AB:21:3E<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; inet addr:192.168.1.18&nbsp; Bcast:192.168.1.255&nbsp; Mask:255.255.255.0<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; inet6 addr: fe80::20c:29ff:feab:213e/64 Scope:Link<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; UP BROADCAST RUNNING MULTICAST&nbsp; MTU:1500&nbsp; Metric:1<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; RX packets:1550249 errors:0 dropped:0 overruns:0 frame:0<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; TX packets:1401847 errors:0 dropped:0 overruns:0 carrier:0<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; collisions:0 txqueuelen:1000 <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; RX bytes:167592321 (159.8 MiB)&nbsp; TX bytes:140584392 (134.0 MiB)<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Interrupt:19 Base address:0x2000 <br /><br />lo&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Link encap:Local Loopback&nbsp; <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; inet addr:127.0.0.1&nbsp; Mask:255.0.0.0<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; inet6 addr: ::1/128 Scope:Host<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; UP LOOPBACK RUNNING&nbsp; MTU:16436&nbsp; Metric:1<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; RX packets:71833 errors:0 dropped:0 overruns:0 frame:0<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; TX packets:71833 errors:0 dropped:0 overruns:0 carrier:0<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; collisions:0 txqueuelen:0 <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; RX bytes:12205495 (11.6 MiB)&nbsp; TX bytes:12205495 (11.6 MiB)<br class="info" /></p>
<p style="text-align: justify;">The command ifconfig is used to configure a network interface. It can be used to set up the interface parameters that are used at boot time. If no arguments are given, the command ifconfig displays the status of the currently active interfaces. If you want to see the status of all interfaces, including those that are currently down, you can use the argument <strong>-a</strong>, as shown below:</p>
<div class="box-content"># <strong>ifconfig -a</strong></div>
<p style="text-align: justify;">Fedora, Redhat Enterprise Linux, CentOS and other similar distributions supports user profiles as well, with different network settings for each user. The user profile and its parameters are set by the network-configuration tools. The relevant system files are placed in:</p>
<p><strong>/etc/sysconfig/netwroking/profiles/profilename/</strong></p>
<p style="text-align: justify;">After boot-up, to switch to a specific profile you have to access a graphical tool, which will allow you to select from among the available profiles. You will have to run:</p>
<div class="box-content">$ <strong>system-config-network</strong></div>
<p>Or for activating the profile from the command line -</p>
<div class="box-content">$ <strong>system-config-network-cmd -p &lt;profilename&gt; --activate</strong></div>
<h2>The Basic Commands for Networking</h2>
<p>The basic commands used in Linux are common to every distro:</p>
<p><strong>ifconfig</strong> - Configures and displays the IP parameters of a network interface</p>
<p><strong>route</strong> - Used to set static routes and view the routing table</p>
<p><strong>hostname</strong> - Necessary for viewing and setting the hostname of the system</p>
<p><strong>netstat</strong> - Flexible command for viewing information about network statistics, current connections, listening ports</p>
<p><strong>arp</strong> - Shows and manages the arp table</p>
<p><strong>mii-tool</strong> - Used to set the interface parameters at data link layer (half/full duplex, interface speed, autonegotiation, etc.)</p>
<p>Many distro are now including the iproute2 tools with enhanced routing and networking tools:</p>
<p><strong>ip</strong> - Multi-purpose command for viewing and setting TCP/IP parameters and routes.</p>
<p><strong>tc</strong> - Traffic control command, used&nbsp; for classifying, prioritizing, sharing, and limiting both inbound and outbound traffic.</p>
<h2>Types of Network Interface</h2>
<p style="text-align: justify;"><strong>LO</strong> (local loop back interface). Local loopback interface is recognized only internal to the computer, the IP address is usually 127.0.0.1 or 127.0.0.2.</p>
<p style="text-align: justify;">Ethernet cards are used to connect to the world external to the computer, usually named eth0, eth1, eth2 and so on.</p>
<p>Network interface files holding the configuration of <strong>LO </strong>and <strong>ethernet </strong>are:</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /etc/sysconfig/nework-scripts/ifcfg-<strong>lo</strong></p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; /etc/sysconfig/nework-scripts/ifcfg-<strong>eth0</strong></p>
<p>To see the contents of the files use the command:</p>
<div class="box-content"># less /etc/sysconfig/network-scripts/ifcfg-lo</div>
<p>Which results in:</p>
<div class="info">DEVICE=lo<br />IPADDR=127.0.0.1<br />NETMASK=255.0.0.0<br />NETWORK=127.0.0.0<br /># If you're having problems with gated making 127.0.0.0/8 a martian,<br /># you can change this to something else (255.255.255.255, for example)<br />BROADCAST=127.255.255.255<br />ONBOOT=yes<br />NAME=loopback</div>
<p>And the following:</p>
<div class="box-content"># <strong>less /etc/sysconfig/network-scripts/ifcfg-eth0</strong></div>
<p>Which gives the following results:</p>
<div class="info">DEVICE="eth0"<br />NM_CONTROLLED="yes"<br />ONBOOT=yes<br />HWADDR=00:0C:29:52:A3:DB<br />TYPE=Ethernet<br />BOOTPROTO=none<br />IPADDR=192.168.1.18<br />PREFIX=24<br />GATEWAY=192.168.1.11<br />DNS1=8.8.8.8<br />DEFROUTE=yes<br />IPV4_FAILURE_FATAL=yes<br />IPV6INIT=no<br />NAME="System eth0"<br />UUID=5fb06bd0-0bb0-7ffb-45f1-d6edd65f3e03</div>
<p>&nbsp;</p>
<h4>Start and Stop the Network Interface Card</h4>
<p>The ifconfig command can be used to start and stop network interface cards:</p>
<div class="download"># <strong>ifconfig eth0 up</strong></div>
<div class="download"># <strong>ifconfig eth0 down</strong></div>
<p>The ifup &amp; ifdown command can also be used to start and stop network interface cards:</p>
<div class="download"># <strong>ifup eth0</strong></div>
<div class="download"># <strong>ifdown eth0</strong></div>
<p>The systemctl commands can also be used to enable, start, stop, restart and check the status of the network interface services -</p>
<div class="download"># <strong>systemctl enable network.service</strong></div>
<div class="download"># <strong>systemctl start network.service</strong></div>
<div class="download"># <strong>systemctl stop network.service</strong></div>
<div class="download"># <strong>systemctl restart network.service</strong></div>
<div class="download"># <strong>systemctl status network.service</strong></div>
<h2>Displaying &amp; Changing your System's Hostname</h2>
<p>The command hostname displays the current hostname of the computer, which is 'Gateway':</p>
<div class="box-content"># <strong>hostname<br /></strong>Gateway<strong><br /></strong></div>
<p>You can change the hostname by giving the new name at the end of the command -</p>
<div class="box-content"># <strong>hostname Firewall-cx</strong></div>
<p style="text-align: justify;">This will change to the new hostname once you have logged out and logged in again. In fact, for any change in the interfaces, the change is implemented only after the user logs in the next time after a log-out.</p>
<p>This concludes our <strong>Linux Network Configuration</strong> article.</p>
<p><br /><br /></p>]]></description>
			<category>Linux - Unix</category>
			<pubDate>Mon, 05 Mar 2012 06:00:00 +1100</pubDate>
		</item>
		<item>
			<title>Configuring Linux to Act as a Firewall - Linux IPTables Basics</title>
			<link>https://www.firewall.cx/operating-systems/linux-unix/linux-services-firewall.html</link>
			<guid isPermaLink="true">https://www.firewall.cx/operating-systems/linux-unix/linux-services-firewall.html</guid>
			<description><![CDATA[<p style="text-align: justify;">What exactly is a firewall? As in the non-computer world, a firewall acts as a physical barrier to prevent fires from spreading. In the computer world too, the firewall acts in a similar manner, only the fires that they prevent from spreading are the attacks, which crackers generate when the computer is on the Internet. Therefore, a firewall can also be called a packet filter, which sits between the computer and the Internet, controlling and regulating the information flow.</p>
<p style="text-align: justify;">Most of the firewalls in use today are the filtering firewalls. They sit between the computer and the Internet and limit access to only specific computers on the network. It can also be programmed to limit the type of communication, and selectively permit or deny several Internet services.</p>
<p style="text-align: justify;">Organizations receive their routable IP addresses from their ISPs. However, the number of IP addresses given is limited. Therefore, alternate ways of sharing the Internet services have to be found without every node on the LAN getting a public IP address. This is done commonly by using private IP addresses, so that all nodes are able to access properly both external and internal network services.</p>
<p style="text-align: justify;">Firewalls are used for receiving incoming transmissions from the Internet and routing the packets to the intended nodes on the LAN. Similarly, firewalls are also used for routing outgoing requests from a node on the LAN to the remote Internet service.</p>
<p style="text-align: justify;">This method of forwarding the network traffic may prove to be dangerous, when modern cracking tools can spoof the internal IP addresses and allow the remote attacker to act as a node on the LAN. In order to prevent this, the iptables provide routing and forwarding policies, which can be implemented for preventing abnormal usage of networking resources. For example, the FORWARD chain lets the administrator control where the packets are routed within a LAN.</p>
<p style="text-align: justify;">LAN nodes can communicate with each other, and they can accept the forwarded packets from the&nbsp; firewall, with their internal IP addresses. However, this does not give them the facility to communicate to the external world and to the Internet.</p>
<p style="text-align: justify;">For allowing the LAN nodes that have private IP addresses to communicate with the outside world, the firewall has to be configured for IP masquerading. The requests that LAN nodes make, are then masked with the IP addresses of the firewall’s external device, such as eth0.</p>
<h2 style="text-align: justify;">How IPtables Can Be Used To Configure Your Firewall</h2>
<p style="text-align: justify;">Whenever a packet arrives at the firewall, it will be either processed or disregarded. The disregarded packets would normally be those, which are malformed in some way or are invalid in some technical way. Based on the packet activity of those that are processed, the packets are enqueued in one of the three builtin ‘tables.’ The first table is the mangle table. This alters the service bits in the TCP header. The second table is the filter queue, which takes care of the actual filtering of the packets. This consists of three chains, and you can place your firewall policy rules in these chains (shown in the diagram below):</p>
<p style="text-align: justify;"><strong>- </strong><strong>Forward</strong> chain: It filters the packets to be forwarded to networks protected by the firewall.</p>
<p style="text-align: justify;"><strong>- </strong><strong>Input</strong> chain: It filters the packets arriving at the firewall.</p>
<p style="text-align: justify;">- <strong>Output</strong> chain: It filters the packets leaving the firewall.</p>
<p style="text-align: justify;">The third table is the <strong>NAT table</strong>. This is where the Network Address Translation or NAT is performed. There are two built-in chains in this:</p>
<p style="text-align: justify;">- <strong>Pre-routing</strong> chain: It NATs the packets whose destination address needs to be changed.</p>
<p style="text-align: justify;">- <strong>Post-routing</strong> chain: It NATs the packets whose source address needs to be changed.</p>
<p style="text-align: justify;">Whenever a rule is set, the table it belongs has to be specified. The ‘Filter’ table is the only exception. This is because most of the 'iptables’ rules are the filter rules. Therefore, the filter table is the default table.</p>
<p>The diagram below shows the flow of packets within the filter table. Packets entering the Linux system follow a specific logical path and decisions are made backed on their characteristics.&nbsp; The path shown below is independent of the network interface they are entering or exiting:</p>
<p style="text-align: center;"><span style="font-size: 14pt;"><strong>The Filter Queue Table</strong></span></p>
<p style="text-align: center;"><img src="https://www.firewall.cx/images/stories/linux-ip-filter-table.gif" alt="linux-ip-filter-table" width="616" height="284" style="display: block; margin-left: auto; margin-right: auto;" /></p>
<p><span style="font-size: 12pt;"></span>Each of the chains filters data packets based on:</p>
<ul class="check">
<li><strong>Source and Destination IP Address</strong></li>
<li><strong>Source and Destination Port number</strong></li>
<li><strong>Network interface (eth0, eth1 etc)</strong></li>
<li><strong>State of the packet&nbsp;</strong></li>
</ul>
<p>Target for the rule: <strong>ACCEPT</strong>, <strong>DROP</strong>, <strong>REJECT</strong>, <strong>QUEUE</strong>, <strong>RETURN</strong> and <strong>LOG</strong></p>
<p style="text-align: justify;">As mentioned previously, the table of NAT rules consists mainly of two chains: each rule is examined in order until one matches. The two chains are called <strong>PREROUTING </strong>(for Destination NAT, as packets first come in), and <strong>POSTROUTING </strong>(for Source NAT, as packets leave).</p>
<p style="text-align: center;"><span style="font-size: 14pt;"><strong>The NAT Table</strong></span></p>
<p style="text-align: center;"><img src="https://www.firewall.cx/images/stories/linux-nat-table.gif" alt="linux-nat-table" width="616" height="286" style="display: block; margin-left: auto; margin-right: auto;" /></p>
<p style="text-align: justify;">At each of the points above, when a packet passes we look up what connection it is associated with. If it's a new connection, we look up the corresponding chain in the NAT table to see what to do with it. The answer it gives will apply to all future packets on that connection.</p>
<p style="text-align: justify;">The most important option here is the table selection option, `-t'. For all <strong>NAT </strong>operations, you will want to use `<strong>-t nat</strong>' for the NAT table. The second most important option to use is `-A' to append a new rule at the end of the chain (e.g. `-A POSTROUTING'), or `-I' to insert one at the beginning (e.g. `-I PREROUTING').</p>
<p style="text-align: justify;">The following command enables NAT for all outgoing packets. Eth0 is our WAN interface:</p>
<div class="box-content"># <strong>iptables -t nat -A POSTROUTING -o eth0 -j MASQUERADE</strong></div>
<p>&nbsp;If you rather implement static NAT, mapping an internal host to a public IP, here's what the command would look like:</p>
<div class="box-content"># <strong>iptables -A POSTROUTING -t nat -s 192.168.0.3 -o eth0 -d 0/0 -j SNAT --to 203.18.45.12</strong></div>
<p>With the above command, all outgoing packets sent from internal IP 192.168.0.3 are mapped to external IP 203.18.45.12.</p>
<p>Taking it the other way around, the command below is used to enable port forwarding from the WAN interface, to an internal host. Any incoming packets on our external interface (eth0) with a destination port (dport) of 80, are forwarded to an internal host (192.168.0.5), port 80:</p>
<div class="box-content"># <strong>iptables -t nat -A PREROUTING -p tcp -i eth0 --dport 80 -j DNAT --to 192.168.0.5:80</strong></div>
<h2 style="text-align: justify;">How The FORWARD Chain Allows Packet Forwarding</h2>
<p style="text-align: justify;">Packet forwarding within a LAN is controlled by the FORWARD chain in the iptables firewall. If the firewall is assigned an internal IP address eth2 and an external IP address on eth0,&nbsp; the rules to be used to allow the forwarding to be done for the entire LAN would be:</p>
<div class="box-content" style="text-align: justify;"># <strong>iptables -A FORWARD -i eth2 -j ACCEPT</strong><br /># <strong>iptables -A FORWARD -o eth0 -j ACCEPT</strong></div>
<p style="text-align: justify;">This way, Firewall gets access to the nodes of the LAN that have internal IP address. The packets enter through the eth2 device of the gateway. They are then routed from one LAN node to their intended destination nodes.</p>
<h2>Dynamic Firewall</h2>
<p style="text-align: justify;">By default, the IPv4 policy in Fedora kernels disables support for IP forwarding. This prevents machines that run Fedora from functioning as a dedicated firewall. Furthermore, starting with Fedora 16, the default firewall solution is now provided by “<strong>firewalld</strong>”. Although it is claimed to be the default, Fedora 16 still ships with the traditional firewall iptables. To enable the dynamic firewall in Fedora, you will need to disable the traditional firewall and install the new dynamic firewalld. The main difference between the two is firewalld is smarter in the sense it does not have to be stopped and restarted each time a policy decision is changed, unlike the traditional firewall.</p>
<p style="text-align: justify;">To disable the traditional firewall, there are two methods, graphical and command line. For the graphical method, the GUI for the System-Config- Firewall can be opened from the Applications menu &gt; Other &gt; Firewall. The firewall can now be disabled.&nbsp;</p>
<p style="text-align: justify;">For the command line, following commands will be needed:</p>
<div class="box-content" style="text-align: justify;"># <strong>systemctl stop iptables.service</strong><br /># <strong>systemctl stop ip6tables.service</strong></div>
<p style="text-align: justify;">To remove iptables entirely from system:</p>
<div class="box-content" style="text-align: justify;"># <strong>systemctl disable iptables.service </strong><br />
<p>rm '/etc/systemd/system/basic.target.wants/iptables.service'</p>
<p># <strong>systemctl disable ip6tables.service</strong></p>
<p>rm '/etc/systemd/system/basic.target.wants/ip6tables.service'</p>
</div>
<p style="text-align: justify;">For installing <strong>Firewalld</strong>, you can use Yum:</p>
<div class="box-content" style="text-align: justify;"># <strong>yum install firewalld firewall-applet</strong></div>
<p style="text-align: justify;">To enable and then start <strong>Firewalld </strong>you will need the following commands:</p>
<div class="box-content" style="text-align: justify;">#<strong> systemctl enable firewalld.service</strong><br /># <strong>systemctl start firewalld.service</strong></div>
<p style="text-align: justify;">The firewall-applet can be started from Applications menu &gt; Other &gt; Firewall Applet</p>
<p style="text-align: justify;">When you hover the mouse over the firewall applet on the top panel, you can see the ports, services, etc. that are enabled. By clicking on the applet, the different services can be started or stopped. However, if you change the status and the applet crashes in order to regain control, you will have to kill the applet by using the following commands:</p>
<div class="box-content" style="text-align: justify;"># <strong>ps -A | grep firewall*</strong></div>
<p style="text-align: justify;">Which will tell you the PID of the running applet, and you can kill it with the following command:</p>
<div class="box-content" style="text-align: justify;"># <strong>kill -9 &lt;<em>pid</em>&gt;</strong></div>
<p style="text-align: justify;">A restart of the applet can be done from the Applications menu, and now the service you had enabled will be visible.</p>
<p style="text-align: justify;">To get around this, the command line option can be used:</p>
<table border="0" style="width: 822px; height: 102px; border: 0pt solid #3300ff;" cellspacing="0" cellpadding="0">
<tbody>
<tr>
<td style="border: 1px solid #5f9ea0;">
<p>Use firewall-cmd to enable, for example ssh:&nbsp;</p>
</td>
<td style="border: 1px solid #5f9ea0;">
<p># <strong>firewall-cmd --enable --service=ssh</strong></p>
</td>
</tr>
<tr>
<td style="border: 1px solid #5f9ea0;">
<p>Enable samba for 10 seconds: Enable samba for 10 seconds:</p>
</td>
<td style="border: 1px solid #5f9ea0;">
<p># <strong>firewall-cmd --enable --service=samba --timeout=10</strong></p>
</td>
</tr>
<tr>
<td style="border: 1px solid #5f9ea0;">
<p>Enable ipp-client:</p>
</td>
<td style="border: 1px solid #5f9ea0;">
<p># <strong>firewall-cmd --enable --service=ipp-client</strong></p>
</td>
</tr>
<tr>
<td style="border: 1px solid #5f9ea0;">
<p>Disable ipp-client:</p>
</td>
<td style="border: 1px solid #5f9ea0;">
<p># <strong>firewall-cmd --disable --service=ipp-client</strong></p>
</td>
</tr>
<tr>
<td style="border: 1px solid #5f9ea0;">
<p>To restore the static firewall with lokkit again simply use (after stopping and disabling Firewalld):</p>
</td>
<td style="border: 1px solid #5f9ea0;">
<p># <strong>lokkit --enabled</strong></p>
</td>
</tr>
</tbody>
</table>]]></description>
			<category>Linux - Unix</category>
			<pubDate>Wed, 29 Feb 2012 07:30:52 +1100</pubDate>
		</item>
		<item>
			<title>Installation and Configuration of Linux DHCP Server </title>
			<link>https://www.firewall.cx/operating-systems/linux-unix/linux-services-dhcp-server.html</link>
			<guid isPermaLink="true">https://www.firewall.cx/operating-systems/linux-unix/linux-services-dhcp-server.html</guid>
			<description><![CDATA[<p style="text-align: justify;">For a cable modem or a DSL connection, the service provider dynamically assigns the IP address to your PC. When you install a DSL or a home cable router between your home network and your modem, your PC will get its IP address from the home router during boot up. A Linux system can be set up as a DHCP server and used in place of the router.</p>
<p>DHCP is not installed by default on your Linux system. It has to be installed by gaining root privileges:</p>
<div class="box-content">$ <strong>su -</strong></div>
<p>You will be prompted for the root password and you can install DHCP by the command:</p>
<div class="box-content"># <strong>yum install dhcp</strong></div>
<p>Once all the dependencies are satisfied, the installation will complete.</p>
<h2>Start the DHCP Server</h2>
<p>You will need root privileges for enabling, starting, stopping or restarting the dhcpd service:</p>
<div class="box-content"># <strong>systemctl enable dhcpd.service</strong></div>
<p>Once enabled, the dhcpd services can be started, stopped and restarted with:</p>
<div class="box-content"># <strong>systemctl start dhcpd.service</strong><br /># <strong>systemctl stop dhcpd.service</strong><br /># <strong>systemctl restart dhcpd.service</strong></div>
<p>or with the use of the following commands if systemctl command is not available:</p>
<div class="box-content"># <strong>service dhcpd start</strong><br /># <strong>service dhcpd stop</strong><br /><strong># <strong>service dhcpd restart</strong></strong></div>
<p>To determine whether dhcpd is running on your system, you can seek its status:</p>
<div class="box-content"># <strong>systemctl status dhcpd.service</strong></div>
<p>Another way of knowing if <strong>dhcpd </strong>is running is to use the '<strong>service</strong>' command:</p>
<div class="box-content"># <strong>service dhcpd status</strong></div>
<p>Note that dhcpd has to be configured to start automatically on next reboot.</p>
<h2>Configuring the Linux DHCP Server</h2>
<p style="text-align: justify;">Depending on the version of the Linux installation you are currently running, the configuration file may reside either in <strong>/etc/dhcpd</strong> or <strong>/etc/dhcpd3</strong> directories.</p>
<p style="text-align: justify;">When you install the DHCP package, a skeleton configuration file and a sample configuration file are created. Both are quite extensive, and the skeleton configuration file has most of its commands deactivated with # at the beginning. The sample configuration file can be found in the location <strong>/usr/share/doc/dhcp*/dhcpd.conf.sample</strong>.</p>
<p style="text-align: justify;">When the dhcpd.conf file is created, a subnet section is generated for each of the interfaces present on your Linux system; this is very important. Following is a small part of the <strong>dhcp.conf</strong> file:</p>
<div class="info">ddns-update-style interim
<p>ignore client-updates</p>
<p>subnet 192.168.1.0 netmask 255.255.255.0 {</p>
<p>&nbsp;&nbsp; # The range of IP addresses the server</p>
<p>&nbsp;&nbsp; # will issue to DHCP enabled PC clients</p>
<p>&nbsp;&nbsp; # booting up on the network</p>
<p>&nbsp;&nbsp; range 192.168.1.201 192.168.1.220;</p>
<p>&nbsp;&nbsp; # Set the amount of time in seconds that</p>
<p>&nbsp;&nbsp; # a client may keep the IP address</p>
<p>&nbsp; default-lease-time 86400;</p>
<p>&nbsp; max-lease-time 86400;</p>
<p>&nbsp;&nbsp; # Set the default gateway to be used by</p>
<p>&nbsp;&nbsp; # the PC clients</p>
<p>&nbsp;&nbsp; option routers 192.168.1.1;</p>
<p>&nbsp;&nbsp; # Don't forward DHCP requests from this</p>
<p>&nbsp;&nbsp; # NIC interface to any other NIC</p>
<p>&nbsp;&nbsp; # interfaces</p>
<p>&nbsp;&nbsp; option ip-forwarding off;</p>
<p>&nbsp;&nbsp; # Set the broadcast address and subnet mask</p>
<p>&nbsp;&nbsp; # to be used by the DHCP clients</p>
<p>&nbsp; option broadcast-address 192.168.1.255;</p>
<p>&nbsp; option subnet-mask 255.255.255.0;</p>
<p>&nbsp;&nbsp; # Set the NTP server to be used by the</p>
<p>&nbsp;&nbsp; # DHCP clients</p>
<p>&nbsp; option ntp-servers 192.168.1.100;</p>
<p>&nbsp;&nbsp; # Set the DNS server to be used by the</p>
<p>&nbsp;&nbsp; # DHCP clients</p>
<p>&nbsp; option domain-name-servers 192.168.1.100;</p>
<p>&nbsp;&nbsp; # If you specify a WINS server for your Windows clients,</p>
<p>&nbsp;&nbsp; # you need to include the following option in the dhcpd.conf file:</p>
<p>&nbsp; option netbios-name-servers 192.168.1.100;</p>
<p>&nbsp;&nbsp; # You can also assign specific IP addresses based on the clients'</p>
<p>&nbsp;&nbsp; # ethernet MAC address as follows (Host's name is "laser-printer":</p>
<p>&nbsp; host laser-printer {</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; hardware ethernet 08:00:2b:4c:59:23;</p>
<p>&nbsp;&nbsp;&nbsp;&nbsp; fixed-address 192.168.1.222;</p>
<p>&nbsp;&nbsp; }</p>
<p>}</p>
<p>#</p>
<p># List an unused interface here</p>
<p>#</p>
<p>subnet 192.168.2.0 netmask 255.255.255.0 {</p>
<p>}</p>
</div>
<p style="text-align: justify;">The IP addresses will need to be changed to meet the ranges suitable to your network. There are other option statements that can be used to configure the DHCP. As you can see, some of the resources such as printers, which need fixed IP addresses, are given the specific IP address based on the NIC MAC address of the device.</p>
<p style="text-align: justify;">For more information, you may read the relevant man pages:</p>
<div class="box-content"># <strong>man dhcp-options</strong></div>
<h2>Routing with a DHCP Server</h2>
<p style="text-align: justify;">When a PC with DHCP configuration boots, it requests for the IP address from the DHCP server. For this, it sends a standard DHCP request packet to the DHCP server with a source IP address of 255.255.255.255. A route has to be added to this 255.255.255.255 address so that the DHCP server knows on which interface it has to send the reply. This is done by adding the route information to the <strong>/etc/sysconfig/network-scripts/route-eth0</strong> file, assuming the route is to be added to the <strong>eth0</strong> interface:</p>
<div class="info">#
<div># File /etc/sysconfig/network-scripts/route-eth0</div>
<div>#</div>
<div>255.255.255.255/32 dev eth0</div>
</div>
<p style="text-align: justify;">After defining the interface for the DHCP routing, it has to be further ensured that your DHCP server listens only to that interface and to no other. For this the <strong>/etc/sysconfig/dhcpd</strong> file has to be edited and the preferred interface added to the <strong>DHCPDARGS</strong> variable. If the interface is to be eth0 following are the changes that need to be made:</p>
<div class="info"># File: /etc/sysconfig/dhcpd<br /><br />DHCPDARGS=eth0</div>
<h2>Testing the DHCP</h2>
<p>Using the netstat command along with the -au option will show the list of interfaces listening on the bootp or DHCP UDP port:</p>
<div class="box-content"># <strong>netstat -au&nbsp; | grep bootp</strong></div>
<p>will result in the following:</p>
<div class="info">udp&nbsp;&nbsp;&nbsp;&nbsp; 0 &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0 192.168.1.100:bootps&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; *:*</div>
<p style="text-align: justify;">Additionally, a check on the<strong> /var/log/messages</strong> file will show the defined interfaces used from the time the dhcpd daemon was started:</p>
<div class="info">Feb&nbsp; 24 17:22:44 Linux-64 dhcpd: Listening on LPF/eth0/00:e0:18:5c:d8:41/192.168.1.0/24<br />Feb&nbsp; 24 17:22:44 Linux-64 dhcpd: Sending on&nbsp; LPF/eth0/00:e0:18:5c:d8:41/192.168.1.0/24</div>
<p>This confirms the DHCP Service has been installed with success and operating correctly.</p>]]></description>
			<category>Linux - Unix</category>
			<pubDate>Tue, 28 Feb 2012 09:14:57 +1100</pubDate>
		</item>
		<item>
			<title>Configuring Linux Samba (SMB) - How to Setup Samba (Linux Windows File Sharing)</title>
			<link>https://www.firewall.cx/operating-systems/linux-unix/linux-services-samba.html</link>
			<guid isPermaLink="true">https://www.firewall.cx/operating-systems/linux-unix/linux-services-samba.html</guid>
			<description><![CDATA[<p style="text-align: justify;">Resource sharing, like file systems and printers, in Microsoft Windows systems, is accomplished using a protocol called the Server Message Block or SMB. For working with such shared resources over a network consisting of Windows systems, an RHEL system must support SMB. The technology used for this is called SAMBA. This provides integration between the Windows and Linux systems. In addition, this is used to provide folder sharing between Linux systems. There are two parts to SAMBA, a Samba Server and a Samba Client.</p>
<p style="text-align: justify;">When an RHEL system accesses resources on a Windows system, it does so using the Samba Client. An RHEL system, by default, has the Samba Client installed.</p>
<p style="text-align: justify;">When an RHEL system serves resources to a Windows system, it uses the package Samba Server or simply Samba. This is not installed by default and has to be exclusively set up.</p>
<h2 style="text-align: justify;">Installing SAMBA on Linux Redhat/CentOS</h2>
<p>Whether Samba is already installed on your RHEL, Fedora or CentOS setup, it can be tested with the following command:"</p>
<div class="box-content">$ <strong>rpm -q samba</strong></div>
<p style="text-align: justify;">The result could be - “<strong>package samba is not installed</strong>,” or something like “<strong>samba-3.5.4-68.el6_0.1.x86_64</strong>” showing the version of Samba present on the system.</p>
<p style="text-align: justify;">To install Samba, you will need to become root with the following command (give the root password, when prompted):</p>
<div class="box-content">$ <strong>su -&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</strong></div>
<p>Then use Yum to install the Linux Samba package:</p>
<div class="box-content"># <strong>yum install samba</strong></div>
<p style="text-align: justify;">This will install the samba package and its dependency package, samba-common.</p>
<p style="text-align: justify;">Before you begin to use or configure Samba, the Linux Firewall (iptables) has to be configured to allow Samba traffic. From the command-line, this is achieved with the use of the following command:</p>
<div class="box-content"># <strong>firewall-cmd --enable --service=samba</strong></div>
<h2>Configuring Linux SAMBA</h2>
<p style="text-align: justify;">The Samba configuration is meant to join an RHEL, Fedora or CentOS system to a Windows Workgroup and setting up a directory on the RHEL system, to act as a shared resource that can be accessed by authenticated Windows users.</p>
<p style="text-align: justify;">To start with, you must gain root privileges with (give the root password, when prompted):</p>
<div class="box-content">$ <strong>su -</strong>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</div>
<p>Edit the Samba configuration file:</p>
<div class="box-content"># <strong>vi /etc/samba/smb.conf</strong></div>
<h2>The smb.conf [Global] Section</h2>
<p style="text-align: justify;">An smb.conf file is divided into several sections. the <strong>[global]</strong> section, which is the first section, has settings that apply to the entire Samba configuration. However, settings in the other sections in the configuration file may override the global settings.</p>
<p style="text-align: justify;">To begin with, set the workgroup, which by default is set as “MYGROUP”:</p>
<div class="box-content">workgroup = MYGROUP</div>
<p>Since most Windows networks are named WORKGROUP by default, the settings have to be changed as:</p>
<div class="box-content">workgroup = <strong>workgroup</strong></div>
<h2>Configure the Shared Resource</h2>
<p style="text-align: justify;">In the next step, a shared resource that will be accessible from the other systems on the Windows network has to be configured. This section has to be given a name by which it will be referred to when shared. For our example, let’s assume you would like share a directory on your Linux system located at /data/network-applications.&nbsp; You’ll need to entitle the entire section as [NetApps] as shown below in our <strong>smb.conf</strong> file:</p>
<div class="box-content">
<p>[NetApps]&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br /><br />path = /data/network-applications</p>
<p>writeable = yes</p>
<p>browseable = yes</p>
<p>valid users = administrator</p>
</div>
<div>&nbsp;When a Windows user browses to the Linux Server, they’ll see a network share labeled</div>
<p>“<strong>NetApps</strong>”.</p>
<p>This concludes the changes to the Samba configuration file.</p>
<h2>Create a Samba User</h2>
<p style="text-align: justify;">Any user wanting to access any Samba shared resource must be configured as a Samba User and assigned a password. This is achieved using the <strong>smbpasswd&nbsp; </strong>command as a root user. Since you have defined “administrator” as the user who is entitled to access the “<strong>/data/network-applications</strong>” directory of the RHEL system, you have to add “administrator” as a Samba user.</p>
<p>You must gain root privileges with the following command (give the root password, when prompted):</p>
<div class="box-content">$ <strong>su - </strong></div>
<p>Add “administrator” as a Windows user -</p>
<div class="box-content"># <strong>smbpasswd -a administrator</strong></div>
<p>The system will respond with</p>
<div class="box-content">New SMB password: &lt;Enter password&gt;<br />Retype new SMB password: &lt;Retype password&gt;</div>
<p>This will result into the following message:</p>
<div class="info">Added user administrator</div>
<p>It will also be necessary to add the same account as a simple linux user, using the same password we used for the samba user:</p>
<div class="box-content"># <strong>adduser administrator</strong><br /># <strong>passwd administrator</strong><br />Changing password for user administrator<br />New UNIX password: <strong>********</strong><br />Retype new UNIX password: <strong>********</strong><br />passwd: all authentication tokens updated successfully.</div>
<div>Now it is time to test the samba configuration file for any errors. For this you can use the command line tool “<strong>testparm</strong>” as root:</div>
<div class="box-content"># <strong>testparm</strong></div>
<div class="info">Load smb config files from /etc/samba/smb.conf<br />
<p>Rlimit_max: rlimit_max (1024) below minimum Windows limit (16384)</p>
<p>Processing section “[NetApps]”</p>
<p>Loaded services file OK.</p>
<p>Server role: ROLE_STANDALONE</p>
<p>Press enter to see a dump of your service definitions</p>
</div>
<p style="text-align: justify;">If you would like to ensure that Windows users are automatically authenticated to your Samba share, without prompting for a username/password, all that’s needed is to add the samba user and password exactly as you Windows clients usernames and password. When a Windows system accesses a Samba share, it will automatically try to log in using the same credentials as the user logged into the Windows system.</p>
<h2>Starting Samba and NetBios Name Service on RHEL</h2>
<p>The Samba and NetBios Nameservice or NMB services have to be enabled and then started for them to take effect:</p>
<div class="box-content"># <strong>systemctl enable smb.service</strong><br />
<div># <strong>systemctl start smb.service</strong></div>
<div># <strong>systemctl enable nmb.service</strong></div>
<div># <strong>systemctl start nmb.service</strong></div>
</div>
<p>In case the services were already running, you may have to restart them again:</p>
<div class="box-content"># <strong>systemctl restart smb.service</strong><br /># <strong>systemctl restart nmb.service</strong></div>
<p>If you are not using systemctl command, you can alternatively start the Samba using a more classic way:</p>
<div class="box-content">[root@gateway] <strong>service smb start<br /></strong>Starting SMB services:&nbsp; [<span style="color: #008000;">OK</span>]<strong><br /></strong></div>
<p style="text-align: justify;">To configure your Linux system to automatically start the Samba service upon boot up, the above command will need to be inserted in the <strong>/etc/rc.local</strong> file. For more information about this, you can read our popular Linux Init Process &amp; Different run levels article</p>
<h2>Accessing the Samba Shares From Windows&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</h2>
<p style="text-align: justify;">Now that you have configured the Samba resources and the services are running, they can be tested for sharing from a Windows system. For this, open the Windows Explorer and navigate to the Network page. Windows should show the RHEL system. If you double-click on the RHEL icon, you will be prompted for the username and password. The username to be entered now is “administrator” with the password that was assigned.&nbsp;</p>
<p style="text-align: justify;">Again, if you are logged on your Windows workstation using the same account and password as that of the Samba service (e.g Administrator), you will not be prompted for any authentication as the Windows &nbsp;operating system will automatically authenticate to the RHEL Samba service using these credentials.</p>
<h2>Accessing Windows Shares From RHEL Workstation or Server</h2>
<p style="text-align: justify;">To access Windows shares from your RHEL system, the package samba-client may have to be installed, unless it is installed by default. For this you must gain root privileges with (give the root password, when prompted):</p>
<div class="box-content">$ <strong>su -&nbsp;</strong>&nbsp;</div>
<p>Install samba-client using the following commands:</p>
<div class="box-content"># <strong>yum install samba-client</strong></div>
<p style="text-align: justify;">To see any shared resource on the Windows system and to access it, you can go to <em>Places &gt; Network</em>. Clicking on the Windows Network icon will open up the list of workgroups available for access.</p>]]></description>
			<category>Linux - Unix</category>
			<pubDate>Tue, 28 Feb 2012 05:30:04 +1100</pubDate>
		</item>
		<item>
			<title>Understanding The Linux Init Process &amp; Different RunLevels</title>
			<link>https://www.firewall.cx/operating-systems/linux-unix/linux-administration-runlevels.html</link>
			<guid isPermaLink="true">https://www.firewall.cx/operating-systems/linux-unix/linux-administration-runlevels.html</guid>
			<description><![CDATA[<p style="text-align: justify;">Different Linux systems can be used in many ways. This is the main idea behind operating different services at different operating levels. For example, the Graphical User Interface can only be run if the system is running the X-server; multiuser operation is only possible if the system is in a multiuser state or mode, such as having networking available. These are the higher states of the system, and sometimes you may want to operate at a lower level, say, in the single user mode or the command line mode.</p>
<p style="text-align: justify;">Such levels are important for different operations, such as for fixing file or disk corruption problems, or for the server to operate in a run level where the X-session is not required. In such cases having services running that depend on higher levels of operation, makes no sense, since they will hamper the operation of the entire system.</p>
<p style="text-align: justify;">Each service is assigned to start whenever its run level is reached. Therefore, when you ensure the startup process is orderly, and you change the mode of the machine, you do not need to bother about which service to manually start or stop.</p>
<p style="text-align: justify;">The main run-levels that a system could use are:</p>
<!--[if gte mso 9]><xml>
 <o:OfficeDocumentSettings>
  <o:AllowPNG/>
 </o:OfficeDocumentSettings>
</xml><![endif][if gte mso 9]><xml>
 <w:WordDocument>
  <w:View>Normal</w:View>
  <w:Zoom>0</w:Zoom>
  <w:TrackMoves/>
  <w:TrackFormatting/>
  <w:PunctuationKerning/>
  <w:ValidateAgainstSchemas/>
  <w:SaveIfXMLInvalid>false</w:SaveIfXMLInvalid>
  <w:IgnoreMixedContent>false</w:IgnoreMixedContent>
  <w:AlwaysShowPlaceholderText>false</w:AlwaysShowPlaceholderText>
  <w:DoNotPromoteQF/>
  <w:LidThemeOther>EN-US</w:LidThemeOther>
  <w:LidThemeAsian>X-NONE</w:LidThemeAsian>
  <w:LidThemeComplexScript>X-NONE</w:LidThemeComplexScript>
  <w:Compatibility>
   <w:BreakWrappedTables/>
   <w:SnapToGridInCell/>
   <w:WrapTextWithPunct/>
   <w:UseAsianBreakRules/>
   <w:DontGrowAutofit/>
   <w:SplitPgBreakAndParaMark/>
   <w:EnableOpenTypeKerning/>
   <w:DontFlipMirrorIndents/>
   <w:OverrideTableStyleHps/>
  </w:Compatibility>
  <m:mathPr>
   <m:mathFont m:val="Cambria Math"/>
   <m:brkBin m:val="before"/>
   <m:brkBinSub m:val="&#45;-"/>
   <m:smallFrac m:val="off"/>
   <m:dispDef/>
   <m:lMargin m:val="0"/>
   <m:rMargin m:val="0"/>
   <m:defJc m:val="centerGroup"/>
   <m:wrapIndent m:val="1440"/>
   <m:intLim m:val="subSup"/>
   <m:naryLim m:val="undOvr"/>
  </m:mathPr></w:WordDocument>
</xml><![endif][if gte mso 9]><xml>
 <w:LatentStyles DefLockedState="false" DefUnhideWhenUsed="true"
  DefSemiHidden="true" DefQFormat="false" DefPriority="99"
  LatentStyleCount="267">
  <w:LsdException Locked="false" Priority="0" SemiHidden="false"
   UnhideWhenUsed="false" QFormat="true" Name="Normal"/>
  <w:LsdException Locked="false" Priority="9" SemiHidden="false"
   UnhideWhenUsed="false" QFormat="true" Name="heading 1"/>
  <w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 2"/>
  <w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 3"/>
  <w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 4"/>
  <w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 5"/>
  <w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 6"/>
  <w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 7"/>
  <w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 8"/>
  <w:LsdException Locked="false" Priority="9" QFormat="true" Name="heading 9"/>
  <w:LsdException Locked="false" Priority="39" Name="toc 1"/>
  <w:LsdException Locked="false" Priority="39" Name="toc 2"/>
  <w:LsdException Locked="false" Priority="39" Name="toc 3"/>
  <w:LsdException Locked="false" Priority="39" Name="toc 4"/>
  <w:LsdException Locked="false" Priority="39" Name="toc 5"/>
  <w:LsdException Locked="false" Priority="39" Name="toc 6"/>
  <w:LsdException Locked="false" Priority="39" Name="toc 7"/>
  <w:LsdException Locked="false" Priority="39" Name="toc 8"/>
  <w:LsdException Locked="false" Priority="39" Name="toc 9"/>
  <w:LsdException Locked="false" Priority="35" QFormat="true" Name="caption"/>
  <w:LsdException Locked="false" Priority="10" SemiHidden="false"
   UnhideWhenUsed="false" QFormat="true" Name="Title"/>
  <w:LsdException Locked="false" Priority="1" Name="Default Paragraph Font"/>
  <w:LsdException Locked="false" Priority="11" SemiHidden="false"
   UnhideWhenUsed="false" QFormat="true" Name="Subtitle"/>
  <w:LsdException Locked="false" Priority="22" SemiHidden="false"
   UnhideWhenUsed="false" QFormat="true" Name="Strong"/>
  <w:LsdException Locked="false" Priority="20" SemiHidden="false"
   UnhideWhenUsed="false" QFormat="true" Name="Emphasis"/>
  <w:LsdException Locked="false" Priority="59" SemiHidden="false"
   UnhideWhenUsed="false" Name="Table Grid"/>
  <w:LsdException Locked="false" UnhideWhenUsed="false" Name="Placeholder Text"/>
  <w:LsdException Locked="false" Priority="1" SemiHidden="false"
   UnhideWhenUsed="false" QFormat="true" Name="No Spacing"/>
  <w:LsdException Locked="false" Priority="60" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light Shading"/>
  <w:LsdException Locked="false" Priority="61" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light List"/>
  <w:LsdException Locked="false" Priority="62" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light Grid"/>
  <w:LsdException Locked="false" Priority="63" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Shading 1"/>
  <w:LsdException Locked="false" Priority="64" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Shading 2"/>
  <w:LsdException Locked="false" Priority="65" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium List 1"/>
  <w:LsdException Locked="false" Priority="66" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium List 2"/>
  <w:LsdException Locked="false" Priority="67" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 1"/>
  <w:LsdException Locked="false" Priority="68" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 2"/>
  <w:LsdException Locked="false" Priority="69" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 3"/>
  <w:LsdException Locked="false" Priority="70" SemiHidden="false"
   UnhideWhenUsed="false" Name="Dark List"/>
  <w:LsdException Locked="false" Priority="71" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful Shading"/>
  <w:LsdException Locked="false" Priority="72" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful List"/>
  <w:LsdException Locked="false" Priority="73" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful Grid"/>
  <w:LsdException Locked="false" Priority="60" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light Shading Accent 1"/>
  <w:LsdException Locked="false" Priority="61" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light List Accent 1"/>
  <w:LsdException Locked="false" Priority="62" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light Grid Accent 1"/>
  <w:LsdException Locked="false" Priority="63" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Shading 1 Accent 1"/>
  <w:LsdException Locked="false" Priority="64" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Shading 2 Accent 1"/>
  <w:LsdException Locked="false" Priority="65" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium List 1 Accent 1"/>
  <w:LsdException Locked="false" UnhideWhenUsed="false" Name="Revision"/>
  <w:LsdException Locked="false" Priority="34" SemiHidden="false"
   UnhideWhenUsed="false" QFormat="true" Name="List Paragraph"/>
  <w:LsdException Locked="false" Priority="29" SemiHidden="false"
   UnhideWhenUsed="false" QFormat="true" Name="Quote"/>
  <w:LsdException Locked="false" Priority="30" SemiHidden="false"
   UnhideWhenUsed="false" QFormat="true" Name="Intense Quote"/>
  <w:LsdException Locked="false" Priority="66" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium List 2 Accent 1"/>
  <w:LsdException Locked="false" Priority="67" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 1 Accent 1"/>
  <w:LsdException Locked="false" Priority="68" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 2 Accent 1"/>
  <w:LsdException Locked="false" Priority="69" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 3 Accent 1"/>
  <w:LsdException Locked="false" Priority="70" SemiHidden="false"
   UnhideWhenUsed="false" Name="Dark List Accent 1"/>
  <w:LsdException Locked="false" Priority="71" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful Shading Accent 1"/>
  <w:LsdException Locked="false" Priority="72" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful List Accent 1"/>
  <w:LsdException Locked="false" Priority="73" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful Grid Accent 1"/>
  <w:LsdException Locked="false" Priority="60" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light Shading Accent 2"/>
  <w:LsdException Locked="false" Priority="61" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light List Accent 2"/>
  <w:LsdException Locked="false" Priority="62" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light Grid Accent 2"/>
  <w:LsdException Locked="false" Priority="63" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Shading 1 Accent 2"/>
  <w:LsdException Locked="false" Priority="64" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Shading 2 Accent 2"/>
  <w:LsdException Locked="false" Priority="65" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium List 1 Accent 2"/>
  <w:LsdException Locked="false" Priority="66" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium List 2 Accent 2"/>
  <w:LsdException Locked="false" Priority="67" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 1 Accent 2"/>
  <w:LsdException Locked="false" Priority="68" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 2 Accent 2"/>
  <w:LsdException Locked="false" Priority="69" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 3 Accent 2"/>
  <w:LsdException Locked="false" Priority="70" SemiHidden="false"
   UnhideWhenUsed="false" Name="Dark List Accent 2"/>
  <w:LsdException Locked="false" Priority="71" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful Shading Accent 2"/>
  <w:LsdException Locked="false" Priority="72" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful List Accent 2"/>
  <w:LsdException Locked="false" Priority="73" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful Grid Accent 2"/>
  <w:LsdException Locked="false" Priority="60" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light Shading Accent 3"/>
  <w:LsdException Locked="false" Priority="61" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light List Accent 3"/>
  <w:LsdException Locked="false" Priority="62" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light Grid Accent 3"/>
  <w:LsdException Locked="false" Priority="63" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Shading 1 Accent 3"/>
  <w:LsdException Locked="false" Priority="64" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Shading 2 Accent 3"/>
  <w:LsdException Locked="false" Priority="65" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium List 1 Accent 3"/>
  <w:LsdException Locked="false" Priority="66" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium List 2 Accent 3"/>
  <w:LsdException Locked="false" Priority="67" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 1 Accent 3"/>
  <w:LsdException Locked="false" Priority="68" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 2 Accent 3"/>
  <w:LsdException Locked="false" Priority="69" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 3 Accent 3"/>
  <w:LsdException Locked="false" Priority="70" SemiHidden="false"
   UnhideWhenUsed="false" Name="Dark List Accent 3"/>
  <w:LsdException Locked="false" Priority="71" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful Shading Accent 3"/>
  <w:LsdException Locked="false" Priority="72" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful List Accent 3"/>
  <w:LsdException Locked="false" Priority="73" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful Grid Accent 3"/>
  <w:LsdException Locked="false" Priority="60" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light Shading Accent 4"/>
  <w:LsdException Locked="false" Priority="61" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light List Accent 4"/>
  <w:LsdException Locked="false" Priority="62" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light Grid Accent 4"/>
  <w:LsdException Locked="false" Priority="63" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Shading 1 Accent 4"/>
  <w:LsdException Locked="false" Priority="64" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Shading 2 Accent 4"/>
  <w:LsdException Locked="false" Priority="65" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium List 1 Accent 4"/>
  <w:LsdException Locked="false" Priority="66" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium List 2 Accent 4"/>
  <w:LsdException Locked="false" Priority="67" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 1 Accent 4"/>
  <w:LsdException Locked="false" Priority="68" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 2 Accent 4"/>
  <w:LsdException Locked="false" Priority="69" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 3 Accent 4"/>
  <w:LsdException Locked="false" Priority="70" SemiHidden="false"
   UnhideWhenUsed="false" Name="Dark List Accent 4"/>
  <w:LsdException Locked="false" Priority="71" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful Shading Accent 4"/>
  <w:LsdException Locked="false" Priority="72" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful List Accent 4"/>
  <w:LsdException Locked="false" Priority="73" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful Grid Accent 4"/>
  <w:LsdException Locked="false" Priority="60" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light Shading Accent 5"/>
  <w:LsdException Locked="false" Priority="61" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light List Accent 5"/>
  <w:LsdException Locked="false" Priority="62" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light Grid Accent 5"/>
  <w:LsdException Locked="false" Priority="63" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Shading 1 Accent 5"/>
  <w:LsdException Locked="false" Priority="64" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Shading 2 Accent 5"/>
  <w:LsdException Locked="false" Priority="65" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium List 1 Accent 5"/>
  <w:LsdException Locked="false" Priority="66" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium List 2 Accent 5"/>
  <w:LsdException Locked="false" Priority="67" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 1 Accent 5"/>
  <w:LsdException Locked="false" Priority="68" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 2 Accent 5"/>
  <w:LsdException Locked="false" Priority="69" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 3 Accent 5"/>
  <w:LsdException Locked="false" Priority="70" SemiHidden="false"
   UnhideWhenUsed="false" Name="Dark List Accent 5"/>
  <w:LsdException Locked="false" Priority="71" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful Shading Accent 5"/>
  <w:LsdException Locked="false" Priority="72" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful List Accent 5"/>
  <w:LsdException Locked="false" Priority="73" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful Grid Accent 5"/>
  <w:LsdException Locked="false" Priority="60" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light Shading Accent 6"/>
  <w:LsdException Locked="false" Priority="61" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light List Accent 6"/>
  <w:LsdException Locked="false" Priority="62" SemiHidden="false"
   UnhideWhenUsed="false" Name="Light Grid Accent 6"/>
  <w:LsdException Locked="false" Priority="63" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Shading 1 Accent 6"/>
  <w:LsdException Locked="false" Priority="64" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Shading 2 Accent 6"/>
  <w:LsdException Locked="false" Priority="65" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium List 1 Accent 6"/>
  <w:LsdException Locked="false" Priority="66" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium List 2 Accent 6"/>
  <w:LsdException Locked="false" Priority="67" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 1 Accent 6"/>
  <w:LsdException Locked="false" Priority="68" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 2 Accent 6"/>
  <w:LsdException Locked="false" Priority="69" SemiHidden="false"
   UnhideWhenUsed="false" Name="Medium Grid 3 Accent 6"/>
  <w:LsdException Locked="false" Priority="70" SemiHidden="false"
   UnhideWhenUsed="false" Name="Dark List Accent 6"/>
  <w:LsdException Locked="false" Priority="71" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful Shading Accent 6"/>
  <w:LsdException Locked="false" Priority="72" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful List Accent 6"/>
  <w:LsdException Locked="false" Priority="73" SemiHidden="false"
   UnhideWhenUsed="false" Name="Colorful Grid Accent 6"/>
  <w:LsdException Locked="false" Priority="19" SemiHidden="false"
   UnhideWhenUsed="false" QFormat="true" Name="Subtle Emphasis"/>
  <w:LsdException Locked="false" Priority="21" SemiHidden="false"
   UnhideWhenUsed="false" QFormat="true" Name="Intense Emphasis"/>
  <w:LsdException Locked="false" Priority="31" SemiHidden="false"
   UnhideWhenUsed="false" QFormat="true" Name="Subtle Reference"/>
  <w:LsdException Locked="false" Priority="32" SemiHidden="false"
   UnhideWhenUsed="false" QFormat="true" Name="Intense Reference"/>
  <w:LsdException Locked="false" Priority="33" SemiHidden="false"
   UnhideWhenUsed="false" QFormat="true" Name="Book Title"/>
  <w:LsdException Locked="false" Priority="37" Name="Bibliography"/>
  <w:LsdException Locked="false" Priority="39" QFormat="true" Name="TOC Heading"/>
 </w:LatentStyles>
</xml><![endif][if gte mso 10]>

<![endif]-->
<table border="0" class="MsoNormalTable" style="margin-left: 2.75pt; border-collapse: collapse; width: 669px; border-width: 0pt; border-style: solid; background-color: #330066;" cellspacing="0" cellpadding="0">
<tbody>
<tr style="background-color: #330066;">
<td style="width: 112px; border-width: 1pt medium 1pt 1pt; border-style: solid none solid solid; border-image: none 100% / 1 / 0 stretch; padding: 2.75pt;" valign="top">
<p class="TableContents" style="text-align: center;"><span style="font-family: verdana, geneva; color: #ffffff;"><strong><span lang="EN-US">RunLevel</span></strong></span></p>
</td>
<td style="width: 334px; border-width: 1pt medium 1pt 1pt; border-style: solid none solid solid; border-image: none 100% / 1 / 0 stretch; padding: 2.75pt;" valign="top">
<p class="TableContents" style="text-align: center;"><span style="font-family: verdana, geneva; color: #ffffff;"><strong><span lang="EN-US">Target</span></strong></span></p>
</td>
<td style="width: 290px; border: 1pt solid black; padding: 2.75pt;" valign="top">
<p class="TableContents" style="text-align: center;"><span style="font-family: verdana, geneva; color: #ffffff;"><strong><span lang="EN-US">Notes</span></strong></span></p>
</td>
</tr>
<tr style="background-color: #141414;">
<td style="background-color: #ffffff;">
<p class="TableContents" style="text-align: center;"><strong><span lang="EN-US" style="font-family: verdana,geneva;">0</span></strong></p>
</td>
<td style="background-color: #ffffff;">
<p class="TableContents"><span style="font-family: verdana,geneva;"><span lang="EN-US">runlevel0.target,</span><span lang="EN-US"> poweroff.target</span></span></p>
</td>
<td style="background-color: #ffffff;">
<p class="TableContents" style="text-align: center;"><span style="font-family: verdana,geneva;"><span lang="EN-US">Halt </span><span lang="EN-US">the </span><span lang="EN-US">system</span></span></p>
</td>
</tr>
<tr style="background-color: #141414;">
<td style="background-color: #ffffff;">
<p class="TableContents" style="text-align: center;"><strong><span style="font-family: verdana,geneva;"><span lang="EN-US">1</span></span></strong></p>
</td>
<td style="background-color: #ffffff;">
<p class="TableContents" style="text-align: center;"><span style="font-family: verdana,geneva;"><span lang="EN-US">runlevel1.target,&nbsp; </span><span lang="EN-US">rescue.target</span></span></p>
</td>
<td style="background-color: #ffffff;">
<p class="TableContents" style="text-align: center;"><span style="font-family: verdana,geneva;"><span lang="EN-US">Single</span><span lang="EN-US"> user</span><span lang="EN-US"> mode</span></span></p>
</td>
</tr>
<tr style="background-color: #141414;">
<td style="background-color: #ffffff;">
<p class="TableContents" style="text-align: center;"><strong><span style="font-family: verdana,geneva;"><span lang="EN-US">2,</span><span lang="EN-US"> 4</span></span></strong></p>
</td>
<td style="background-color: #ffffff;">
<p class="TableContents" style="text-align: center;"><span style="font-family: verdana,geneva;"><span lang="EN-US">runlevel2.target,</span><span lang="EN-US"> runlevel4.target, </span><span lang="EN-US">multi-user.target</span></span></p>
</td>
<td style="background-color: #ffffff;">
<p class="TableContents" style="text-align: center;"><span style="font-family: verdana,geneva;"><span lang="EN-US">User-defined/Site-specific </span><span lang="EN-US">runlevels. </span><span lang="EN-US">By</span><span lang="EN-US"> default, </span><span lang="EN-US">identical</span><span lang="EN-US"> to </span><span lang="EN-US">3</span></span></p>
</td>
</tr>
<tr style="background-color: #141414;">
<td style="background-color: #ffffff;">
<p class="TableContents" style="text-align: center;"><strong><span lang="EN-US" style="font-family: verdana,geneva;">3</span></strong></p>
</td>
<td style="background-color: #ffffff;">
<p class="TableContents" style="text-align: center;"><span style="font-family: verdana,geneva;"><span lang="EN-US">runlevel3.target,</span><span lang="EN-US">multi-user.target</span></span></p>
</td>
<td style="background-color: #ffffff;">
<p class="TableContents" style="text-align: center;"><span style="font-family: verdana,geneva;"><span lang="EN-US">Multi-user, </span><span lang="EN-US">non-graphical. </span><span lang="EN-US">Users </span><span lang="EN-US">can</span><span lang="EN-US"> usually </span><span lang="EN-US">login </span><span lang="EN-US">via</span><span lang="EN-US"> multiple </span><span lang="EN-US">consoles </span><span lang="EN-US">or </span><span lang="EN-US">via </span><span lang="EN-US">the </span><span lang="EN-US">network.</span></span></p>
</td>
</tr>
<tr style="background-color: #141414;">
<td style="background-color: #ffffff;">
<p class="TableContents" style="text-align: center;"><strong><span lang="EN-US" style="font-family: verdana,geneva;">5</span></strong></p>
</td>
<td style="background-color: #ffffff;">
<p class="TableContents"><span style="font-family: verdana,geneva;"><span lang="EN-US">runlevel5.target, </span><span lang="EN-US">graphical.target</span></span></p>
</td>
<td style="background-color: #ffffff;">
<p class="TableContents" style="text-align: center;"><span style="font-family: verdana,geneva;"><span lang="EN-US">Multi-user, </span><span lang="EN-US">graphical. </span><span lang="EN-US">Usually </span><span lang="EN-US">has </span><span lang="EN-US">all </span><span lang="EN-US">the</span><span lang="EN-US"> services </span><span lang="EN-US">of </span><span lang="EN-US">runlevel</span><span lang="EN-US">3 </span><span lang="EN-US">plus </span><span lang="EN-US">a</span><span lang="EN-US"> graphical</span><span lang="EN-US"> login - X11<br /></span></span></p>
</td>
</tr>
<tr style="background-color: #141414;">
<td style="background-color: #ffffff;">
<p class="TableContents" style="text-align: center;"><strong><span lang="EN-US" style="font-family: verdana,geneva;">6</span></strong></p>
</td>
<td style="background-color: #ffffff;">
<p class="TableContents" style="text-align: center;"><span style="font-family: verdana,geneva;"><span lang="EN-US">runlevel6.target, </span><span lang="EN-US">reboot.target</span></span></p>
</td>
<td style="background-color: #ffffff;">
<p class="TableContents" style="text-align: center;"><span lang="EN-US" style="font-family: verdana,geneva;">Reboot</span></p>
</td>
</tr>
<tr style="background-color: #141414;">
<td style="background-color: #ffffff;">
<p class="TableContents"><strong><span lang="EN-US" style="font-family: verdana,geneva;">Emergency</span></strong></p>
</td>
<td style="background-color: #ffffff;">
<p class="TableContents" style="text-align: center;"><span lang="EN-US" style="font-family: verdana,geneva;">emergency.target</span></p>
</td>
<td style="background-color: #ffffff;">
<p class="TableContents" style="text-align: center;"><span style="font-family: verdana,geneva;"><span lang="EN-US">Emergency </span><span lang="EN-US">shell</span></span></p>
</td>
</tr>
</tbody>
</table>
<p style="text-align: justify;">The system and service manager for Linux is now “<strong>systemd</strong>”. It provides a concept of “targets”, as in the table above. Although targets serve a similar purpose as runlevels, they act somewhat differently. Each target has a name instead of a number and serves a specific purpose. Some targets may be implemented after inheriting all the services of another target and adding more services to it.</p>
<p style="text-align: justify;">Backward compatibility exists, so switching targets using familiar telinit RUNLEVEL command still works. On Fedora installs, runlevels 0, 1, 3, 5 and 6 have an exact mapping with specific systemd targets. However, user-defined runlevels such as 2 and 4 are not mapped that way. They are treated similar to runlevel 3, by default.</p>
<p style="text-align: justify;">For using the user-defined levels 2 and 4, new systemd targets have to be defined that makes use of one of the existing runlevels as a base. Services that you want to enable have to be symlinked into that directory.</p>
<p>The most commonly used runlevels in a currently running linux box are 3 and 5. You can change runlevels in many ways.</p>
<p>A runlevel of 5 will take you to GUI enabled login prompt interface and desktop operations. Normally by default installation, this would take your to GNOME or KDE linux environment. A runlevel of 3 would boot your linux box to terminal mode (non-X) linux box and drop you to a terminal login prompt. Runlevels 0 and 6 are runlevels for halting or rebooting your linux respectively.</p>
<p style="text-align: justify;">Although compatible with <strong>SysV</strong> and <strong>LSB</strong> init scripts, <strong>systemd</strong>:</p>
<ul class="check">
<li>Provides aggressive parallelization capabilities.</li>
<li>Offers on-demand starting of daemons.</li>
<li>Uses socket and D-Bus activation for starting services.</li>
<li>Keeps track of processes using Linux cgroups.</li>
<li>Maintains mount and automount points.</li>
<li>Supports snapshotting and restoring of the system state.</li>
<li>Implements an elaborate transactional dependency-based service control logic.</li>
</ul>
<p style="text-align: justify;"><strong>Systemd</strong> starts up and supervises the entire operation of the system. It is based on the notion of units. These are composed of a name, and a type as shown in the table above. There is a matching configuration file with the same name and type. For example, a unit avahi.service will have a configuration file with an identical name, and will be a unit that encapsulates the Avahi daemon. There are seven different types of units, namely, service, socket, device, mount, automount, target, and snapshot.</p>
<p style="text-align: justify;">To introspect and or control the state of the system and service manager under systemd, the main tool or command is “<strong>systemctl</strong>”. When booting up, <strong>systemd</strong> activates the default.target. The job of the default.target is to activate the different services and other units by considering their dependencies. The ‘<strong>system.unit=</strong>’ command line option parses arguments to the kernel to override the unit to be activated. For example,</p>
<p style="text-align: justify;">systemd.unit=rescue.target is a special target unit for setting up the base system and a rescue shell (similar to run level 1);</p>
<p style="text-align: justify;">systemd.unit=emergency.target, is very similar to passing init=/bin/sh but with the option to boot the full system from there;</p>
<p style="text-align: justify;">systemd.unit=multi-user.target for setting up a non-graphical multi-user system;</p>
<p style="text-align: justify;">systemd.unit=graphical.target for setting up a graphical login screen.</p>
<h2 style="text-align: justify;">How to Enable/Disable Linux Services</h2>
<p style="text-align: justify;">Following are the commands used to enable or disable services in CentOS, Redhat Enterprise Linux and Fedora systems:</p>
<p style="text-align: justify;">Activate a service immediately e.g postfix:</p>
<div class="box-content" style="text-align: justify;">[root@gateway ~]# <strong>service postfix start</strong><br />Starting postfix: [&nbsp; <span style="color: #00ff00;"><span style="color: #000000;">OK&nbsp;</span> </span>]</div>
<p style="text-align: justify;">To deactivate a service immediately e.g postfix:</p>
<div class="box-content" style="text-align: justify;">[root@gateway ~]# <strong>service postfix stop</strong><br />Shutting down postfix: [&nbsp;<span style="color: #000000;"> OK&nbsp;</span> ]</div>
<p>To restart a service immediately e.g postfix:</p>
<div class="box-content">[root@gateway ~]# <strong>service postfix restart</strong><br />Shutting down postfix: [<span style="color: #ff0000;">FAILED</span>]<br />Starting postfix: [&nbsp;<span style="color: #000000;"> OK&nbsp; </span>]</div>
<p>You might have noticed the 'FAILED' message. This is normal behavior as we shut down the postfix service with our first command (service postfix stop), so shutting it down a second time would naturally fail!</p>
<h2>Determine Which Linux Services are Enabled at Boot</h2>
<p>The first column of this output is the name of a service which is currently enabled at boot. Review each listed service to determine whether it can be disabled.</p>
<p>&nbsp;If it is appropriate to disable a service , do so using the command:</p>
<p class="box-content">[root@gateway ~]#<code>&nbsp;<span style="color: #000000;"><strong>chkconfig -level <em>servicename </em>off</strong></span></code></p>
<p>Run the following command to obtain a list of all services programmed to run in the different Run Levels of your system:</p>
<div class="box-content">[root@gateway ~]#&nbsp; chkconfig --list | grep :on<span style="color: #000000;"><strong><code><br /><br /></code></strong></span>NetworkManager&nbsp; 0:off&nbsp;&nbsp; 1:off&nbsp;&nbsp; 2:on&nbsp;&nbsp;&nbsp; 3:on&nbsp;&nbsp;&nbsp; 4:on&nbsp;&nbsp;&nbsp; 5:on&nbsp;&nbsp;&nbsp; 6:off<br /> abrtd&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0:off&nbsp;&nbsp; 1:off&nbsp;&nbsp; 2:off&nbsp;&nbsp; 3:on&nbsp;&nbsp;&nbsp; 4:off&nbsp;&nbsp; 5:on&nbsp;&nbsp;&nbsp; 6:off<br /> acpid&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0:off&nbsp;&nbsp; 1:off&nbsp;&nbsp; 2:on&nbsp;&nbsp;&nbsp; 3:on&nbsp;&nbsp;&nbsp; 4:on&nbsp;&nbsp;&nbsp; 5:on&nbsp;&nbsp;&nbsp; 6:off<br /> atd&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0:off&nbsp;&nbsp; 1:off&nbsp;&nbsp; 2:off&nbsp;&nbsp; 3:on&nbsp;&nbsp;&nbsp; 4:on&nbsp;&nbsp;&nbsp; 5:on&nbsp;&nbsp;&nbsp; 6:off<br /> auditd&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0:off&nbsp;&nbsp; 1:off&nbsp;&nbsp; 2:on&nbsp;&nbsp;&nbsp; 3:on&nbsp;&nbsp;&nbsp; 4:on&nbsp;&nbsp;&nbsp; 5:on&nbsp;&nbsp;&nbsp; 6:off<br /> autofs&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0:off&nbsp;&nbsp; 1:off&nbsp;&nbsp; 2:off&nbsp;&nbsp; 3:on&nbsp;&nbsp;&nbsp; 4:on&nbsp;&nbsp;&nbsp; 5:on&nbsp;&nbsp;&nbsp; 6:off<br /> avahi-daemon&nbsp;&nbsp;&nbsp; 0:off&nbsp;&nbsp; 1:off&nbsp;&nbsp; 2:off&nbsp;&nbsp; 3:on&nbsp;&nbsp;&nbsp; 4:on&nbsp;&nbsp;&nbsp; 5:on&nbsp;&nbsp;&nbsp; 6:off<br /> cpuspeed&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0:off&nbsp;&nbsp; 1:on&nbsp;&nbsp;&nbsp; 2:on&nbsp;&nbsp;&nbsp; 3:on&nbsp;&nbsp;&nbsp; 4:on&nbsp;&nbsp;&nbsp; 5:on&nbsp;&nbsp;&nbsp; 6:off<br /> crond&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0:off&nbsp;&nbsp; 1:off&nbsp;&nbsp; 2:on&nbsp;&nbsp;&nbsp; 3:on&nbsp;&nbsp;&nbsp; 4:on&nbsp;&nbsp;&nbsp; 5:on&nbsp;&nbsp;&nbsp; 6:off<br /> cups&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0:off&nbsp;&nbsp; 1:off&nbsp;&nbsp; 2:on&nbsp;&nbsp;&nbsp; 3:on&nbsp;&nbsp;&nbsp; 4:on&nbsp;&nbsp;&nbsp; 5:on&nbsp;&nbsp;&nbsp; 6:off<br /> haldaemon&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0:off&nbsp;&nbsp; 1:off&nbsp;&nbsp; 2:off&nbsp;&nbsp; 3:on&nbsp;&nbsp;&nbsp; 4:on&nbsp;&nbsp;&nbsp; 5:on&nbsp;&nbsp;&nbsp; 6:off<br /> httpd&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0:off&nbsp;&nbsp; 1:off&nbsp;&nbsp; 2:off&nbsp;&nbsp; 3:on&nbsp;&nbsp;&nbsp; 4:off&nbsp;&nbsp; 5:off&nbsp;&nbsp; 6:off<br /> ip6tables&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0:off&nbsp;&nbsp; 1:off&nbsp;&nbsp; 2:on&nbsp;&nbsp;&nbsp; 3:on&nbsp;&nbsp;&nbsp; 4:on&nbsp;&nbsp;&nbsp; 5:on&nbsp;&nbsp;&nbsp; 6:off<br /> iptables&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0:off&nbsp;&nbsp; 1:off&nbsp;&nbsp; 2:on&nbsp;&nbsp;&nbsp; 3:on&nbsp;&nbsp;&nbsp; 4:on&nbsp;&nbsp;&nbsp; 5:on&nbsp;&nbsp;&nbsp; 6:off<br /> irqbalance&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0:off&nbsp;&nbsp; 1:off&nbsp;&nbsp; 2:off&nbsp;&nbsp; 3:on&nbsp;&nbsp;&nbsp; 4:on&nbsp;&nbsp;&nbsp; 5:on&nbsp;&nbsp;&nbsp; 6:off</div>
<p>Several of these services are required, but several others might not serve any purpose in your environment, and use CPU and memory resources that would be better allocated to applications. Assuming you don't RPC services, autofs or NFS, they can be disabled for all Run Levels using the following commands:</p>
<div class="box-content">[root@gateway ~]#<code></code> <strong>/sbin/chkconfig –level 0123456 portmap off</strong><br /> [root@gateway ~]#<code></code> <strong>/sbin/chkconfig –level 0123456 nfslock off</strong><br /> [root@gateway ~]#<code></code> <strong>/sbin/chkconfig –level 0123456 portmap off</strong><br /> [root@gateway ~]#<code></code> <strong>/sbin/chkconfig –level 0123456 netfs off</strong><br /> [root@gateway ~]#<code></code> <strong>/sbin/chkconfig –level 0123456 portmap off</strong><br /> [root@gateway ~]#<code></code> <strong>/sbin/chkconfig –level 0123456 rpcgssd off</strong><br /> [root@gateway ~]#<code></code> <strong>/sbin/chkconfig –level 0123456 portmap off</strong><br /> [root@gateway ~]#<code></code> <strong>/sbin/chkconfig –level 0123456 rpcidmapd off</strong><br /> [root@gateway ~]#<code></code> <strong>/sbin/chkconfig –level 0123456 portmap off</strong><br /> [root@gateway ~]#<code></code> <strong>/sbin/chkconfig –level 0123456 autofs off</strong></div>
<h4 style="text-align: justify;">How to Change Runlevels</h4>
<p style="text-align: justify;">You can switch to&nbsp;<strong>runlevel 3</strong> by running: &nbsp;&nbsp;&nbsp;</p>
<div class="box-content" style="text-align: justify;">[root@gateway ~]# <strong>systemctl isolate multi-user.target</strong></div>
<p style="text-align: justify;">(or)</p>
<div class="box-content" style="text-align: justify;">[root@gateway ~]# <strong>systemctl isolate runlevel3.target</strong></div>
<p style="text-align: justify;">You can switch to&nbsp;<strong>runlevel 5</strong> by running: &nbsp;&nbsp;&nbsp;</p>
<div class="box-content" style="text-align: justify;">[root@gateway ~]# <strong>systemctl isolate graphical.target</strong></div>
<p style="text-align: justify;">(or)</p>
<div class="box-content" style="text-align: justify;">[root@gateway ~]# <strong>systemctl isolate runlevel5.target</strong></div>
<h2 style="text-align: justify;">How to Change the Default Runlevel Using Systemd</h2>
<div style="text-align: justify;">The systemd uses symlinks to point to the default runlevel. You have to delete the existing symlink first, before you can create a new one:</div>
<div>&nbsp;</div>
<div class="box-content">[root@gateway ~]# <strong>rm /etc/systemd/system/default.target</strong></div>
<p style="text-align: justify;">Switch to <strong>runlevel 3</strong> by default:</p>
<p><span class="box-content">[root@gateway ~]# <strong>ln -sf /lib/systemd/system/multi-user.target /etc/systemd/system/default.target&nbsp;</strong></span> Switch to <strong>runlevel 5</strong> by default: &nbsp;&nbsp;&nbsp;</p>
<p class="box-content" style="text-align: justify;">[root@gateway ~]# <strong>ln -sf /lib/systemd/system/graphical.target /etc/systemd/system/default.target</strong></p>
<p style="text-align: justify;">&nbsp;And just in case you were wondering, <strong>systemd</strong> does not use the classic<strong> /etc/inittab</strong> file!</p>
<h2 style="text-align: justify;">How to Change The Default Runlevel Using The Inittab File</h2>
<p>There's the&nbsp;<strong>Systemd</strong> way and of course, the&nbsp;<strong>Inittab</strong> way. In this case, Runlevels are represented by <strong>/etc/inittab</strong> text file. The default runlevel is always specified from <strong>/etc/inittab</strong> text file.</p>
<p>To change the default runlevel in fedora ,edit <strong>/etc/inittab</strong> and find the line that looks like this:&nbsp;<strong> id:5:initdefault:</strong></p>
<p>The number 5 represents a runlevel with X enabled (GNOME/KDE mostly). If you want to change to runlevel 3, simply change this</p>
<div><span class="box-content">id:5:initdefault:</span>to this</div>
<div><br /><span class="box-content">id:3:initdefault:</span>Save and reboot your linux box. Your linux box would now reboot on runlevel 3, a runlevel without X or GUI. Avoid changing the default <strong>/etc/iniittab</strong> runlevel value to <strong>0</strong> or <strong>6</strong> .</div>
<p>Users having difficulty with Linux editors can also read our article on how to use <strong>Vi</strong>, the popular Linux editor: <a href="https://www.firewall.cx/operating-systems/linux-unix/linux-vi.html" title="Linux VIM / Vi Editor - Tutorial - Basic &amp; Advanced Features">Linux VIM / Vi Editor - Tutorial - Basic &amp; Advanced Features</a>.</p>
<div id="_mcePaste" class="mcePaste" style="position: absolute; left: -10000px; top: 0px; width: 1px; height: 1px; overflow: hidden;">RunLevel&nbsp;&nbsp;&nbsp; Target&nbsp;&nbsp;&nbsp; Notes<br />0&nbsp;&nbsp;&nbsp; runlevel0.target, poweroff.target &nbsp;&nbsp;&nbsp; Halt the system. <br />1, s, single&nbsp;&nbsp;&nbsp; runlevel1.target, rescue.target &nbsp;&nbsp;&nbsp; Single user mode. <br />2, 4&nbsp;&nbsp;&nbsp; runlevel2.target, runlevel4.target, multi-user.target&nbsp;&nbsp;&nbsp; User-defined/Site-specific runlevels. By default, identical to 3. <br />3&nbsp;&nbsp;&nbsp; runlevel3.target, multi-user.target &nbsp;&nbsp;&nbsp; Multi-user, non-graphical. Users can usually login via multiple consoles or via the network. <br />5&nbsp;&nbsp;&nbsp; runlevel5.target, graphical.target &nbsp;&nbsp;&nbsp; Multi-user, graphical. Usually has all the services of runlevel 3 plus a graphical login. <br />6&nbsp;&nbsp;&nbsp; runlevel6.target, reboot.target &nbsp;&nbsp;&nbsp; Reboot <br />Emergency&nbsp;&nbsp;&nbsp; emergency.target &nbsp;&nbsp;&nbsp; Emergency shell</div>]]></description>
			<category>Linux - Unix</category>
			<pubDate>Fri, 24 Feb 2012 09:40:32 +1100</pubDate>
		</item>
		<item>
			<title>How To Secure Your Linux Server or Workstation - Linux Best Security Practices</title>
			<link>https://www.firewall.cx/operating-systems/linux-unix/linux-security-practices.html</link>
			<guid isPermaLink="true">https://www.firewall.cx/operating-systems/linux-unix/linux-security-practices.html</guid>
			<description><![CDATA[<p>Below are some of the most common recommendations and method to effectively <strong>secure</strong> a <strong>Linux Server or Workstation</strong>.</p>
<h2>Boot Disk</h2>
<p style="text-align: justify;">One of the foremost requisites of a secure Linux server is the boot disk. Nowadays, this has become rather simple as most Linux distributions are on bootable CD/DVD/USB sticks. Other options are, to use rescue disks such as the ‘<strong>TestDisk</strong>’, ‘<strong>SystemRescueCD</strong>’, ‘<strong>Trinity Rescue Kit</strong>’ or ‘<strong>Ubuntu Rescue Remix</strong>’. These will enable you to gain access to your system, if you are unable to gain entry, and also to recover files and partitions if your system is damaged. They can be used to check for virus attacks and to detect rootkits.</p>
<p style="text-align: justify;">Next requirement is for patching your system. Distributions issue notices for security updates, and you can download and patch your system using these updates. RPM users can use the ‘<strong>up2date</strong>’ command, which automatically resolves dependencies, rather than the other rpm commands, since these only report dependencies and do not help to resolve them.</p>
<h2>Patch Your System</h2>
<p style="text-align: justify;">While RedHat/CentOS/Fedora users can patch their systems with a single command, '<strong>yum update</strong>',&nbsp; &nbsp;Debian users can patch their systems with the ‘<strong>sudo apt-get update</strong>’ command, which will update the sources list. This should be followed by the command ‘sudo apt-get upgrade’, which will install the newest version of all packages on the machine, resolving all the dependencies automatically.</p>
<p style="text-align: justify;">New vulnerabilities are being discovered all the time, and patches follow. One way to learn about new vulnerabilities is to subscribe to the mailing list of the distribution used.</p>
<h2>Disable Unnecessary Services</h2>
<p style="text-align: justify;">Your system becomes increasingly insecure as you operate more services, since every service has its own security issues. For improving the overall system performance and for enhancing security, it is important to detect and eliminate unnecessary running services. To know which services are currently running on your system, you can use commands like:</p>
<div class="box-content">[root@gateway~]# <strong>ps aux</strong>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;</div>
<p><br />Following is an example output of the above command:</p>
<div class="box-content">[root@gateway~]# <strong>ps aux</strong><br />USER&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; PID&nbsp;&nbsp; %CPU&nbsp;&nbsp; %MEM&nbsp;&nbsp;&nbsp; VSZ&nbsp; &nbsp; RSS&nbsp; TTY&nbsp; STAT START&nbsp;&nbsp; TIME COMMAND<br />root&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 1&nbsp;&nbsp; 0.0 &nbsp;&nbsp; 0.1&nbsp;&nbsp; 2828 &nbsp;&nbsp; 1400&nbsp; ?&nbsp;&nbsp;&nbsp;&nbsp; Ss&nbsp;&nbsp; Feb08&nbsp;&nbsp; 0:02 /sbin/init<br />root&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 2&nbsp;&nbsp; 0.0 &nbsp;&nbsp; 0.0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0&nbsp; &nbsp; &nbsp;&nbsp; 0&nbsp; ?&nbsp;&nbsp;&nbsp;&nbsp; S&nbsp;&nbsp;&nbsp; Feb08&nbsp;&nbsp; 0:00 [kthreadd]<br />root&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 3 &nbsp; 0.0 &nbsp;&nbsp; 0.0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0&nbsp; &nbsp;&nbsp; &nbsp; 0&nbsp; ?&nbsp;&nbsp;&nbsp;&nbsp; S&nbsp;&nbsp;&nbsp; Feb08&nbsp;&nbsp; 0:00 [migration/0]<br />root&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 4&nbsp;&nbsp; 0.0&nbsp;&nbsp;&nbsp; 0.0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0&nbsp;&nbsp; &nbsp; &nbsp; 0&nbsp; ?&nbsp;&nbsp;&nbsp;&nbsp; S&nbsp;&nbsp;&nbsp; Feb08&nbsp;&nbsp; 0:00 [ksoftirqd/0]<br />root&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 5&nbsp;&nbsp; 0.0 &nbsp;&nbsp; 0.0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0&nbsp;&nbsp; &nbsp; &nbsp; 0&nbsp; ?&nbsp;&nbsp;&nbsp;&nbsp; S&nbsp;&nbsp;&nbsp; Feb08&nbsp;&nbsp; 0:00 [watchdog/0]<br />root&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 6 &nbsp; 0.0&nbsp;&nbsp;&nbsp; 0.0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0&nbsp; &nbsp; &nbsp;&nbsp; 0&nbsp; ?&nbsp;&nbsp;&nbsp;&nbsp; S&nbsp;&nbsp;&nbsp; Feb08&nbsp;&nbsp; 0:00 [events/0]<br />root&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 7 &nbsp; 0.0&nbsp;&nbsp;&nbsp; 0.0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; 0&nbsp; ?&nbsp;&nbsp;&nbsp;&nbsp; S&nbsp;&nbsp;&nbsp; Feb08&nbsp;&nbsp; 0:00 [cpuset]<br />root&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 8&nbsp;&nbsp; 0.0&nbsp;&nbsp;&nbsp; 0.0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0&nbsp;&nbsp; &nbsp; &nbsp; 0&nbsp; ?&nbsp;&nbsp;&nbsp;&nbsp; S&nbsp;&nbsp;&nbsp; Feb08&nbsp;&nbsp; 0:00 [khelper]<br />root&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 9&nbsp;&nbsp; 0.0 &nbsp;&nbsp; 0.0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0&nbsp;&nbsp;&nbsp; &nbsp;&nbsp; 0&nbsp; ?&nbsp;&nbsp;&nbsp;&nbsp; S&nbsp;&nbsp;&nbsp; Feb08&nbsp;&nbsp; 0:00 [netns]<br />root&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 10&nbsp;&nbsp; 0.0 &nbsp;&nbsp; 0.0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; 0&nbsp; ?&nbsp;&nbsp;&nbsp;&nbsp; S&nbsp;&nbsp;&nbsp; Feb08&nbsp;&nbsp; 0:00 [async/mgr]<br />root&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 11&nbsp;&nbsp; 0.0&nbsp;&nbsp;&nbsp; 0.0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0&nbsp;&nbsp; &nbsp; &nbsp; 0&nbsp; ?&nbsp;&nbsp;&nbsp;&nbsp; S&nbsp;&nbsp;&nbsp; Feb08&nbsp;&nbsp; 0:00 [pm]<br />root&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 12 &nbsp; 0.0&nbsp;&nbsp;&nbsp; 0.0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0&nbsp; ?&nbsp;&nbsp;&nbsp;&nbsp; S&nbsp;&nbsp;&nbsp; Feb08&nbsp;&nbsp; 0:00 [sync_supers]<br /> apache&nbsp;&nbsp; 17250 &nbsp; 0.0&nbsp;&nbsp;&nbsp; 0.9&nbsp; 37036&nbsp; &nbsp; 10224 ?&nbsp;&nbsp;&nbsp;&nbsp; S&nbsp;&nbsp;&nbsp; Feb08&nbsp;&nbsp; 0:00 /usr/sbin/httpd<br />apache&nbsp;&nbsp; 25686 &nbsp; 0.0 &nbsp;&nbsp; 0.9&nbsp; 37168&nbsp; &nbsp; 10244 ?&nbsp;&nbsp;&nbsp;&nbsp; S&nbsp;&nbsp;&nbsp; Feb08&nbsp;&nbsp; 0:00 /usr/sbin/httpd<br />apache&nbsp;&nbsp; 28290 &nbsp; 0.0 &nbsp;&nbsp; 0.9&nbsp; 37168&nbsp;&nbsp;&nbsp; 10296 ?&nbsp;&nbsp;&nbsp;&nbsp; S&nbsp;&nbsp;&nbsp; Feb08&nbsp;&nbsp; 0:00 /usr/sbin/httpd<br />postfix&nbsp;&nbsp; 30051&nbsp; 0.0&nbsp;&nbsp;&nbsp; 0.2&nbsp; 10240 &nbsp; &nbsp; 2136 ?&nbsp;&nbsp;&nbsp;&nbsp; S&nbsp;&nbsp;&nbsp; 23:35&nbsp;&nbsp; 0:00 pickup -l -t fifo -u<br />postfix &nbsp; 30060&nbsp; 0.0 &nbsp;&nbsp; 0.2&nbsp; 10308&nbsp;&nbsp;&nbsp;&nbsp; 2280 ?&nbsp;&nbsp;&nbsp;&nbsp; S&nbsp;&nbsp;&nbsp; 23:35&nbsp;&nbsp; 0:00 qmgr -l -t fifo -u<br />root&nbsp;&nbsp;&nbsp; &nbsp; 31645&nbsp; 0.1&nbsp;&nbsp;&nbsp; 0.3&nbsp; 11120&nbsp;&nbsp;&nbsp;&nbsp; 3112 ?&nbsp;&nbsp;&nbsp;&nbsp; Ss&nbsp;&nbsp; 23:45&nbsp;&nbsp; 0:00 sshd: root@pts/1</div>
<p><br />The following command will list all start-up scripts for RunLevel 3 (Full multiuser mode):</p>
<div class="box-content">[root@gateway~]# <strong>ls -l /etc/rc.d/rc3.d/S* &nbsp;</strong>&nbsp;&nbsp;&nbsp; <br />OR<br />[root@gateway~]# <strong>ls -l /etc/rc3.d/S*&nbsp;</strong>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp;</div>
<p>Here is an example output of the above commands:</p>
<div class="box-content">[root@gateway~]# <strong>ls -l /etc/rc.d/rc3.d/S*<br /></strong>lrwxrwxrwx. 1 root root 23 Jan 16 17:45 /etc/rc.d/rc3.d/S00microcode_ctl -&gt; ../init.d/microcode_ctl<br />lrwxrwxrwx. 1 root root 17 Jan 16 17:44 /etc/rc.d/rc3.d/S01sysstat -&gt; ../init.d/sysstat<br />lrwxrwxrwx. 1 root root 22 Jan 16 17:44 /etc/rc.d/rc3.d/S02lvm2-monitor -&gt; ../init.d/lvm2-monitor<br />lrwxrwxrwx. 1 root root 19 Jan 16 17:39 /etc/rc.d/rc3.d/S08ip6tables -&gt; ../init.d/ip6tables<br />lrwxrwxrwx. 1 root root 18 Jan 16 17:38 /etc/rc.d/rc3.d/S08iptables -&gt; ../init.d/iptables<br />lrwxrwxrwx. 1 root root 17 Jan 16 17:42 /etc/rc.d/rc3.d/S10network -&gt; ../init.d/network<br />lrwxrwxrwx. 1 root root 16 Jan 27 01:04 /etc/rc.d/rc3.d/S11auditd -&gt; ../init.d/auditd<br />lrwxrwxrwx. 1 root root 21 Jan 16 17:39 /etc/rc.d/rc3.d/S11portreserve -&gt; ../init.d/portreserve<br />lrwxrwxrwx. 1 root root 17 Jan 16 17:44 /etc/rc.d/rc3.d/S12rsyslog -&gt; ../init.d/rsyslog<br />lrwxrwxrwx. 1 root root 18 Jan 16 17:45 /etc/rc.d/rc3.d/S13cpuspeed -&gt; ../init.d/cpuspeed<br />lrwxrwxrwx. 1 root root 20 Jan 16 17:40 /etc/rc.d/rc3.d/S13irqbalance -&gt; ../init.d/irqbalance<br />lrwxrwxrwx. 1 root root 17 Jan 16 17:38 /etc/rc.d/rc3.d/S13rpcbind -&gt; ../init.d/rpcbind<br />lrwxrwxrwx. 1 root root 19 Jan 16 17:43 /etc/rc.d/rc3.d/S15mdmonitor -&gt; ../init.d/mdmonitor<br />lrwxrwxrwx. 1 root root 20 Jan 16 17:38 /etc/rc.d/rc3.d/S22messagebus -&gt; ../init.d/messagebus<strong><br /></strong></div>
<p><br id="tinymce" class="mceContentBody" /></p>
<p>To disable services, you can either stop a running service or change the configuration in a way that the service will not start on the next reboot. To stop a running service, RedHat/CentOS users can use the command -</p>
<div><span class="box-content">&nbsp;[root@gateway~]# service service-name stop</span> The example below shows the command used to stop our Apache web service (httpd):</div>
<div class="box-content">[root@gateway~]# <strong>service httpd stop</strong><br />Stopping httpd: [&nbsp; <strong>OK</strong>&nbsp; ]</div>
<p>In order to stop the service from starting up at boot time, you could use -</p>
<div><span class="box-content">&nbsp;&nbsp;[root@gateway~]# <strong>/sbin/chkconfig --levels 2345 service-name off&nbsp;&nbsp;</strong></span>Where '<em>service-name</em>' is replaced by the name of the service. e.g <strong>httpd &nbsp;&nbsp;&nbsp; </strong></div>
<p style="text-align: justify;">You can also remove a service from the startup script by using the following commands which will remove the httpd (Apache Web server) service:</p>
<p class="box-content">[root@gateway~]# <strong>/bin/mv /etc/rc.d/rc3.d/S85httpd /etc/rc.d/rc3.d/K85httpd&nbsp;</strong></p>
<p>or</p>
<div class="box-content">[root@gateway~]# <strong>/bin/mv /etc/rc3.d/S85httpd /etc/rc3.d/K85httpd</strong></div>
<p style="text-align: justify;">During startup on of the Linux operating system, the <strong>rc </strong>program looks in the /etc/rc.d/rc3.d directory (when configured with Runlevel 3),&nbsp; executing any <strong>K*</strong> scripts with an option of <strong>stop</strong>. Then, all the <strong>S*</strong> scripts are started with an option of <strong>start</strong>. Scripts are started in numerical order—thus, the S08iptables script is started before the S85httpd script. This allows you to choose exactly when your script starts without having to edit files. The same rule applies with the <strong>K*</strong> scripts.</p>
<p style="text-align: justify;">In some rare cases, services may have to be removed from /etc/xinetd.d or /etc/inetd.conf file.</p>
<p style="text-align: justify;">Debian users can use the following commands to stop, start and restart a service -</p>
<div class="box-content">$ <strong>sudo service httpd stop</strong><br />$ <strong>sudo service httpd start</strong> &nbsp;&nbsp; <br />$ <strong>sudo service httpd restart</strong>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;</div>
<p>Remove the startup script by using the following commands:</p>
<div class="box-content">[root@gateway~]# <strong>/bin/mv /etc/rc.d/rc3.d/S85httpd /etc/rc.d/rc3.d/K85httpd </strong></div>
<p>or</p>
<div class="box-content">[root@gateway~]# <strong>/bin/mv /etc/rc3.d/S85httpd /etc/rc3.d/K85httpd </strong></div>
<h2>Host-based Firewall Protection with IPtables</h2>
<p style="text-align: justify;">Using iptables firewall, you could limit access to your server by IP address or by host/domain name. RedHat/CentOS users have a file <strong>/etc/sysconfig/iptables</strong> based on the services that were ‘allowed’ during installation. The file can be edited to accept some services and block others. In case the requested service does not match any of the <strong>ACCEPT </strong>lines in the iptables file, the packet is logged and then rejected.</p>
<p style="text-align: justify;">RedHat/CentOS/Fedora users will have to install the iptables with:</p>
<div class="box-content">[root@gateway~]# <strong>yum install iptables</strong></div>
<p>Debian users will need to install the iptables with the help of:</p>
<div class="box-content">$ <strong>sudo apt-get install iptables</strong></div>
<p>Then use the iptables command line options/switches to implement the policy. The rules of iptables usually take the form:&nbsp;&nbsp;&nbsp; <br />•&nbsp;&nbsp;&nbsp; INIVIDUAL REJECTS FIRST<br />•&nbsp;&nbsp;&nbsp; THEN OPEN IT UP<br />•&nbsp;&nbsp;&nbsp; BLOCK ALL</p>
<p>As it is a table of rules, the first rule takes precedence. If the first rule dis-allows everything nothing else following later will matter.</p>
<p>In practice, a firewall script is needed which is created using the following sequence:<br />1) Create your script<br />2) Make it executable <br />3) Run the script</p>
<p>Following are the commands used for the above order:</p>
<div class="box-content">[root@gateway~]# <strong>vim /root/firewall.sh&nbsp;&nbsp;</strong>&nbsp; <br />[root@gateway~]# <strong>chmod 755 /root/firewall.sh&nbsp;</strong>&nbsp;&nbsp; <br />[root@gateway~]# <strong>/root/firewall.sh&nbsp;</strong> &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp; &nbsp;</div>
<p>Updating the firewall script is simply a matter of re-editing to make the necessary changes and running it again. Since iptables does not run as a daemon, instead of stopping, the rules are only flushed with the '<strong>-F</strong>' option:&nbsp;</p>
<div class="box-content">[root@gateway~]# <strong>iptables -F INPUT</strong><br />[root@gateway~]# <strong>iptables -F OUTPUT</strong><br />[root@gateway~]# <strong>iptables -F FORWARD</strong><br />[root@gateway~]# <strong>iptables -F POSTROUTING -t nat</strong><br />[root@gateway~]# <strong>iptables -F PREROUTING -t nat</strong></div>
<p style="text-align: justify;">At startup/reboot, all that is needed is to execute the script to flush the iptables rules. The simplest way to do this is to add the script (/root/firewall.sh) to the file <strong>/etc/rc.local</strong> file.</p>
<h2>Best Practices</h2>
<p style="text-align: justify;">Apart from the above, a number of steps need to be taken to keep your Linux server safe from outside attackers. Key files should be checked for security and must be set to root for both owner and group:</p>
<p><strong>/etc/fstab<br />/etc/passwd<br />/etc/shadow<br />/etc/group</strong></p>
<p style="text-align: justify;">The above should be owned by root and and their permission must be 644 (rw-r--r--), except /etc/shadow which should have the permission of 400 (r--------).</p>
<p style="text-align: justify;">You can read more on how to set permissions on your Linux files in our <a href="https://www.firewall.cx/operating-systems/linux-unix/linux-file-folder-permissions.html" target="_blank" title="Linux File &amp; Folder Permissions">Linux File &amp; Folder Permissions</a> article</p>
<h2>Limiting Root Access</h2>
<p style="text-align: justify;">Implement a password policy, which forces users to change their login passwords, for example, every 60 to 90 days, starts warning them within 7 days of expiry, and accepts passwords that are a minimum of 14 characters in length.</p>
<p style="text-align: justify;">Root access must be limited by using the following commands for RedHat/CentOS/Fedora -</p>
<div class="box-content">[chris@gateway~]$ <strong>su -</strong><br />Password: &lt;<strong><em>enter root password</em></strong>&gt;<br />[root@gateway ~]#</div>
<p>Or for RedHat/CentOS/Fedora/Debian:</p>
<div class="box-content">[chris@gateway~]$ <strong>sudo -i<br /></strong>Password: &lt;<strong><em>enter root password</em></strong>&gt;<strong><br /></strong>[root@gateway ~]#<strong><br /></strong></div>
<p>Provide the password of the user, who can assume root privileges.</p>
<p style="text-align: justify;">Only root should be able to access <strong>CRON</strong>. Cron is a system daemon used to execute desired tasks (in the background) at designated times.</p>
<p style="text-align: justify;">A crontab is a simple text file with a list of commands meant to be run at specified times. It is edited with a command-line utility. These commands (and their run times) are then controlled by the cron daemon, which executes them in the system background. Each user has a crontab file which specifies the actions and times at which they should be executed, these jobs will run regardless of whether the user is actually logged into the system. There is also a root crontab for tasks requiring administrative privileges. This system crontab allows scheduling of systemwide tasks (such as log rotations and system database updates). You can use the <strong>man crontab</strong> command to find more information about it.</p>
<p style="text-align: justify;">Lastly, the use of SSH is recommended instead of Telnet for remote accesses. The main difference between the two is that SSH encrypts all data exchanged between the user and server, while telnet sends all data in clear-text, making it extremely easy to obtain root passwords and other sensitive information. All unused TCP/UDP ports must also be blocked using IPtables.</p>]]></description>
			<category>Linux - Unix</category>
			<pubDate>Sat, 11 Feb 2012 03:11:56 +1100</pubDate>
		</item>
		<item>
			<title>Understanding, Administering Linux Groups and User Accounts</title>
			<link>https://www.firewall.cx/operating-systems/linux-unix/linux-groups-user-accounts.html</link>
			<guid isPermaLink="true">https://www.firewall.cx/operating-systems/linux-unix/linux-groups-user-accounts.html</guid>
			<description><![CDATA[<p style="text-align: justify;">In a multi-user environment like Linux, every file is owned by a user and a group. There can be others as well who may be allowed to work with the file. What this means is, as a user, you have all the rights to read, write and execute a file created by you. Now, you may belong to a group, so you can give your group members the permission to either read, write (modify) and/or execute your file. In the same way, for those who do not belong to your group, and are called 'others', you may give similar permissions.</p>
<p style="text-align: justify;">How are these permissions shown and how are they modified?</p>
<p style="text-align: justify;">In a shell, command line or within a terminal, if you type '<strong>ls -l</strong>', you will see something like the following:</p>
<div class="box-content">drwxr-x--- 3 tutor firewall&nbsp; 4096 2010-08-21 15:52 Videos<br />-rwxr-xr-x 1 tutor firewall&nbsp;&nbsp;&nbsp; 21 2010-05-10 10:02 Doom-TNT</div>
<p style="text-align: justify;">The last group of words on the right is the name of the file or directory. Therefore, '<strong>Videos</strong>' is a directory, which is designated by the ’<strong>d</strong>’ at the start of the line. Since '<strong>Doom-TNT</strong>' shows only a '<strong>-</strong>', at the start of the line, it is a file. The following series of '<strong>rwx...</strong>' are the permissions of the file or directory. You will notice that there are three sets of '<strong>rwx</strong>'. The first three rwx are the read, write and execute permissions for the owner '<strong>tutor</strong>'.</p>
<p style="text-align: justify;">Since the <strong>r</strong>, <strong>w </strong>and <strong>x</strong> are present, it means the owner has all the permissions. The next set of '<strong>rwx</strong>' is permissions for the group, which is the second '<strong>username</strong>'. You will notice that the '<strong>w</strong>' here is missing, and is replaced by a '<strong>-</strong>'. This means group members of the group '<strong>username</strong>' have permissions to read and to execute '<strong>Doom-TNT</strong>', but cannot write to it or modify it. Permission for '<strong>others</strong>' is the same. Therefore, others can also read and execute the file, but not write to it or modify it. Others do not have any permissions for the directory '<strong>Videos</strong>' and hence cannot read (enter), modify or execute '<strong>Videos</strong>'.</p>
<p style="text-align: justify;">You can use the '<strong>chmod</strong>' command to change the permissions you give. The basic form of the command looks like:</p>
<p style="text-align: justify;"><strong>chmod 'who'+/-'permissions' 'filename</strong>'</p>
<p style="text-align: justify;">Here, the '<strong>filename</strong>' is the file, whose permissions are being modified. You are giving the permissions to '<strong>who</strong>', and '<strong>who</strong>' can be <strong>u</strong>=user (meaning you), <strong>g</strong>=group, <strong>o</strong>=others, or <strong>a</strong>=all.</p>
<p style="text-align: justify;">The '<strong>permissions</strong>' you give can be <strong>r</strong>=read, <strong>w</strong>=write, <strong>x</strong>=execute or '<strong>space</strong>' for no permissions. Using a '<strong>+</strong>' grants the permission, and a '<strong>-</strong>' removes it.</p>
<p style="text-align: justify;">As an example, the command '<strong>chmodo+r Videos</strong>' will result in:</p>
<div class="box-content">drwxr-xr-- 3 username&nbsp; 4096 2010-08-21 15:52 Videos</div>
<p>and now '<strong>others</strong>' can read '<strong>Videos</strong>'. Similarly, '<strong>chmod o-r Videos</strong>', will set it back as it was, before the modification.<br /><br />Linux file and folder permissions are covered extensively on our dedicated <a href="https://www.firewall.cx/operating-systems/linux-unix/linux-file-folder-permissions.html" target="_blank" title="Linux File &amp; Folder permissions">Linux File &amp; Folder permissions</a> article.</p>
<h2>What Happens In A GUI environment?</h2>
<p style="text-align: justify;">If you are using a file manager like Nautilus, you will find a '<strong>view</strong>' menu, which has an entry '<strong>Visible Columns</strong>'. This opens up another window showing the visible columns that you can select to allow the file manager to show. You will find there are columns like '<strong>Owner</strong>', '<strong>Group</strong>' and '<strong>Permissions</strong>'. By turning these columns ON, you can see the same information as with the '<strong>ls -l</strong>' command.</p>
<p style="text-align: justify;">If you want to modify the permissions of any file from Nautilus, you will have to right-click on the file with your mouse. This will open up a window through which you can access the 'properties' of the file. In the properties window, you can set or unset any of the permissions for owner, group and others.</p>
<h2>What Are Group IDs?</h2>
<p style="text-align: justify;">Because Linux is a multi-user system, there could be several users logged in and using the system. The system needs to keep track of who is using what resources. This is primarily done by allocating identification numbers or IDs to all users and groups. To see the IDs, you may enter the command '<strong>id</strong>', which will show you the user ID, the group ID and the IDs of the groups to which you belong.</p>
<p style="text-align: justify;">A standard Linux installation, for example Ubuntu, comes with some groups preconfigured. Some of these are:</p>
<div class="info">4(adm), 20(dialout), 21(fax), 24(cdrom), 26(tape), 29(audio), 30(dip), 44(video), 46(plugdev), 104(fuse), 106(scanner), 114(netdev), 116(lpadmin), 118(admin), 125(sambashare)</div>
<p style="text-align: justify;">The numbers are the group IDs and their names are given inside brackets. Unless you are a member of a specific group, you are not allowed to use that resource. For example, unless you belong to the group 'cdrom', you will not be allowed to access the contents of any CDs and DVDs that are mounted on the system.</p>
<p style="text-align: justify;">In Linux, the '<strong>root</strong>' or '<strong>super user</strong>', also called the '<strong>administrator</strong>', is a user who is a member of all the groups and has all permissions in all places, unless specifically changed. Users who have been granted root privileges defined in the '<strong>sudoers</strong>' file, can assume root status temporarily with the '<strong>sudo</strong>' command.</p>]]></description>
			<category>Linux - Unix</category>
			<pubDate>Mon, 06 Feb 2012 06:47:31 +1100</pubDate>
		</item>
		<item>
			<title>Understanding Linux File System Quotas - Installation and Setup</title>
			<link>https://www.firewall.cx/operating-systems/linux-unix/linux-file-system-quotas.html</link>
			<guid isPermaLink="true">https://www.firewall.cx/operating-systems/linux-unix/linux-file-system-quotas.html</guid>
			<description><![CDATA[<p style="text-align: justify;">When you are running your own web hosting, it is important to monitor how much space is being used by each user. This is not a simple task to be done manually since one of the users or group could fill up the whole hard disk, preventing others from availing any space. Therefore, it is important to allow each user or group their own hard disk space called quota and locking them out from using more than what is allotted.</p>
<p style="text-align: justify;">The system administrator sets a limit or a disk quota to restrict certain aspects of the file system usage on a Linux operating system. In multi-user environments, disk quotas are very useful since a large number of users have access to the file system. They may be logging into the system directly or using their disk space remotely. They may also be accessing their files through NFS or through Samba. If several users host their websites on your web space, you need to implement the quota system.</p>
<h2>How to Install Linux Quota</h2>
<p style="text-align: justify;">For installing a quota system, for example, in your Debian or RedHAT Linux system, you will need two tools called ‘quota’ and ‘quotatool’. At the time of installation of these tools, you will be asked if you wish to send daily reminders to users who are going over their quotas.</p>
<p style="text-align: justify;">Now, the administrator also needs to know the users that are going over their quota. The system will send an email to this effect, therefore the email address of the administrator has to be inputted next.</p>
<p style="text-align: justify;">In case the user does not know what to do if the system gives him a warning message, the next entry is the contact number of the administrator. This will be displayed to the user along with the warning message. With this, the quota system installation is completed.</p>
<p style="text-align: justify;">At this time, a user and a group have to be created and proper permissions given. For creating, you have to assume root status, and type the following commands:</p>
<div class="box-content" style="text-align: justify;"># <strong>touch /aquota.user /aquota.group</strong><br /># <strong>chmod 600 /aquota.*</strong></div>
<p style="text-align: justify;">Next, these have to be mounted in the proper place on the root file system. For this, an entry has to be made in the ‘<strong>fstab</strong>’ file in the directory /etc. In the ‘<strong>fstab</strong>’ file, the root entry has to be modified with:</p>
<div class="info" style="text-align: justify;"><strong>noatime,nodiratime,usrjquota=aquota.user,grpjquota=aquota.group,jqfmt=vfsv0</strong></div>
<p>Next, the computer has to be rebooted, or the file system remounted with the command:</p>
<div class="box-content" style="text-align: justify;"># <strong>mount -o remount /</strong></div>
<p style="text-align: justify;">&nbsp;The system is now able to work with disk quotas. However, you have to allow the system to build/rebuild its table of current disk usage. For this, you must first run quotacheck.</p>
<p style="text-align: justify;">This will examine all the quota-enabled file systems, and build a table of the current disk usage for each one. The operating system’s copy of the disk usage is then updated. In addition, this creates the disk quota files for the entire file system. If the quota already existed, they are updated. The command looks like:</p>
<div class="box-content" style="text-align: justify;"># <strong>quotacheck -avugm</strong></div>
<p style="text-align: justify;">&nbsp;Some explanation is necessary here. The (<strong>-a</strong>) tells the command that all locally mounted quota-enabled file systems are to be checked. The (<strong>-v</strong>) is to display the status information as the check proceeds. The (<strong>-u</strong>) is to enable checking the user disk quota information. The (<strong>-g</strong>) is to enable checking the group disk quota information. Finally, the (<strong>-m</strong>) tells the command not to try to remount file system read-only.</p>
<p style="text-align: justify;">After checking and building the disk-quota files is over, the disk-quotas have to be turned on. This is done by the command ‘<strong>quotaon</strong>’ to inform the system that disk-quota should be enabled, such as:</p>
<div class="box-content" style="text-align: justify;"># <strong>quotaon -avug</strong></div>
<p style="text-align: justify;">Here, (<strong>-a</strong>) forces all file systems in <strong>/etc/fstab</strong> to enable their quotas. The (<strong>-v</strong>) displays status information for each file system. The (<strong>-u</strong>) is for enabling the user quota. The (<strong>-g</strong>) enables the group quota.</p>
<h2>Define Quota for Each User/Group</h2>
<p style="text-align: justify;">Now that the system is ready with quotas, you can start defining what each user or group gets as his limit. Two types of limits can be defined. One is the soft limit and the other is the hard limit. To set the two limits try editing the size and inode size with:</p>
<div class="box-content" style="text-align: justify;"># <strong>edquota -u $USER</strong></div>
<p>This allows you to edit the following line:</p>
<div class="box-content" style="text-align: justify;">/dev/sda1 &nbsp; 1024&nbsp; 200000&nbsp; 400000 1024 0&nbsp;&nbsp;&nbsp; 0</div>
<p style="text-align: justify;">Here, the soft limit is <strong>200000 </strong>(<strong>200MB</strong>) and the hard limit is <strong>400000 </strong>(<strong>400MB</strong>). You may change it to suit your user (denoted by <strong>$USER</strong>).</p>
<p style="text-align: justify;">The soft limit has a grace period of 7 days by default. It can be changed to days, hours, minutes, or seconds as desired by:</p>
<div class="box-content" style="text-align: justify;"># <strong>edquota -t</strong></div>
<p>This allows you to edit the line below. It has been modified to change the default to 15 minutes:</p>
<div class="info">/dev/sda1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 15minutes&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 7days</div>
<p><br />For editing group quota use:</p>
<div class="box-content"># <strong>edquota -g $GROUP</strong></div>
<h2>Quota Status Report</h2>
<p>Now that you have set a quota, it is easy to create a mini report on how much space a user has used. For this use the command:</p>
<div class="box-content">root@gateway [~]# <strong>repquota&nbsp; -a</strong><br /><br />
<div>*** Report for user quotas on device /dev/vzfs</div>
<div>Block grace time: 00:00; Inode grace time: 00:00</div>
<div>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; &nbsp;&nbsp; Block&nbsp; limits&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; File limits</div>
<div>User&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; used&nbsp;&nbsp;&nbsp; soft&nbsp;&nbsp;&nbsp; hard&nbsp; grace&nbsp;&nbsp;&nbsp; used&nbsp; soft&nbsp; hard&nbsp; grace</div>
<div>---------------------------------------------------------------------</div>
<div>root&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; --&nbsp; 5578244&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0&nbsp;&nbsp;&nbsp;&nbsp; 117864&nbsp;&nbsp;&nbsp;&nbsp; 0&nbsp;&nbsp;&nbsp;&nbsp; 0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</div>
<div>bin&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; --&nbsp;&nbsp;&nbsp; 30936&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 252&nbsp;&nbsp;&nbsp;&nbsp; 0&nbsp;&nbsp;&nbsp;&nbsp; 0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</div>
<div>mail&nbsp; &nbsp; &nbsp;&nbsp;&nbsp; --&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 76&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; 19&nbsp;&nbsp;&nbsp;&nbsp; 0&nbsp;&nbsp;&nbsp;&nbsp; 0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</div>
<div>nobody&nbsp;&nbsp; &nbsp;&nbsp; --&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp; 0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 3&nbsp;&nbsp;&nbsp;&nbsp; 0&nbsp;&nbsp;&nbsp;&nbsp; 0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</div>
<div>mailnull&nbsp;&nbsp;&nbsp; --&nbsp;&nbsp;&nbsp;&nbsp; 3356&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 157&nbsp;&nbsp;&nbsp;&nbsp; 0&nbsp;&nbsp;&nbsp;&nbsp; 0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</div>
<div>smmsp&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; --&nbsp;&nbsp; &nbsp; &nbsp;&nbsp; 4&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 2&nbsp;&nbsp;&nbsp;&nbsp; 0&nbsp;&nbsp;&nbsp;&nbsp; 0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</div>
<div>named&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; --&nbsp;&nbsp; &nbsp;&nbsp; 860&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 11&nbsp;&nbsp;&nbsp;&nbsp; 0&nbsp;&nbsp;&nbsp;&nbsp; 0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</div>
<div>rpc&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; --&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; 0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 1&nbsp;&nbsp; &nbsp;&nbsp; 0&nbsp;&nbsp;&nbsp;&nbsp; 0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</div>
<div>mailman&nbsp; &nbsp;&nbsp; --&nbsp; &nbsp; 40396&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0&nbsp; &nbsp; &nbsp;&nbsp; 2292&nbsp;&nbsp; &nbsp; 0&nbsp;&nbsp;&nbsp;&nbsp; 0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</div>
<div>dovecot&nbsp;&nbsp;&nbsp;&nbsp; --&nbsp;&nbsp;&nbsp; &nbsp; &nbsp; 4&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 1&nbsp;&nbsp;&nbsp;&nbsp; 0&nbsp;&nbsp;&nbsp;&nbsp; 0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</div>
<div>mysql&nbsp;&nbsp;&nbsp; &nbsp;&nbsp; --&nbsp;&nbsp; 181912&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp; 857&nbsp;&nbsp;&nbsp;&nbsp; 0&nbsp;&nbsp;&nbsp;&nbsp; 0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</div>
<div>firewall&nbsp;&nbsp;&nbsp; --&nbsp;&nbsp;&nbsp; 92023&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 153600 153600&nbsp;&nbsp;&nbsp;&nbsp; 21072&nbsp;&nbsp; 0&nbsp;&nbsp;&nbsp;&nbsp; 0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</div>
<div>#55&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp; --&nbsp; &nbsp;&nbsp; 1984&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0&nbsp;&nbsp; &nbsp; &nbsp;&nbsp;&nbsp; 74&nbsp;&nbsp;&nbsp;&nbsp; 0&nbsp;&nbsp;&nbsp;&nbsp; 0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</div>
<div>#200&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp; --&nbsp;&nbsp;&nbsp;&nbsp; 1104&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 63&nbsp;&nbsp;&nbsp;&nbsp; 0&nbsp;&nbsp;&nbsp;&nbsp; 0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</div>
<div>#501&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp; --&nbsp;&nbsp;&nbsp;&nbsp; 6480&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 429&nbsp;&nbsp;&nbsp; 0&nbsp;&nbsp;&nbsp;&nbsp; 0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</div>
<div>#506&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp; --&nbsp;&nbsp;&nbsp; &nbsp; 648&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 80&nbsp;&nbsp;&nbsp;&nbsp; 0&nbsp;&nbsp;&nbsp;&nbsp; 0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</div>
<div>#1000&nbsp;&nbsp; &nbsp; &nbsp; --&nbsp;&nbsp;&nbsp;&nbsp; 7724&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0&nbsp;&nbsp;&nbsp; &nbsp; &nbsp; 0&nbsp;&nbsp; &nbsp; &nbsp; 878&nbsp;&nbsp;&nbsp;&nbsp; 0&nbsp;&nbsp;&nbsp;&nbsp; 0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</div>
<div>#50138&nbsp;&nbsp; &nbsp;&nbsp; --&nbsp; &nbsp; 43044&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0&nbsp;&nbsp;&nbsp; &nbsp; &nbsp; 0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 3948&nbsp;&nbsp;&nbsp;&nbsp; 0&nbsp;&nbsp;&nbsp;&nbsp; 0</div>
</div>
<p>Once the user and group quotas are setup, it is simple to manage your storage. Therefore you do not allow users to hog all of the disk space. By using disk quotas, you force your users to be tidier, and users and groups of users will not fill their home directories with junk or old documents that are no longer needed.</p>]]></description>
			<category>Linux - Unix</category>
			<pubDate>Thu, 12 Jan 2012 05:38:15 +1100</pubDate>
		</item>
		<item>
			<title>Linux System Resource &amp; Performance Monitoring</title>
			<link>https://www.firewall.cx/operating-systems/linux-unix/linux-system-resource-monitoring.html</link>
			<guid isPermaLink="true">https://www.firewall.cx/operating-systems/linux-unix/linux-system-resource-monitoring.html</guid>
			<description><![CDATA[<p style="text-align: justify;">You may be a user at home, a user in a LAN (local area network), or a system administrator of a large network of computers. Alternatively, you may be maintaining a large number of servers with multiple hard drives. Whatever may be your function, monitoring your Linux system is of paramount importance to keep it running in top condition.</p>
<p style="text-align: justify;">While monitoring a complex computer system, some of the basic things to be kept in mind are the utilization of the hard disk, memory or RAM, CPU, the running processes, and the network traffic. Analysis of the information made available during monitoring is necessary, since all the resources are limited. Reaching the limits or exceeding them on any of the resources could lead to severe consequences, which may even be catastrophic.</p>
<h2>Monitoring The Hard Disk Space</h2>
<p style="text-align: justify;">Use a simple command like:</p>
<div class="box-content" style="text-align: justify;">$ <strong>df -h</strong><br />
<p>This results in the output:</p>
<p>Filesystem&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; Size&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; Used &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; Avail &nbsp;&nbsp;&nbsp; Use% &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Mounted on</p>
<p>/dev/sda1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 22G&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; 5.0G&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &nbsp; 16G&nbsp; &nbsp;&nbsp;&nbsp; 24% &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; /</p>
<p>/dev/sda2&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; 34G&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; 23G&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; 9.1G &nbsp;&nbsp;&nbsp; 72% &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; /home</p>
</div>
<p style="text-align: justify;">This shows there are two partitions (1 &amp; 2) of the hard disk sda, which are currently at 24% and 72% utilization. The total size is shown in gigabytes (G). How much is used and balance available is shown as well. However, checking each hard disk to see the percentage used can be a big drag. It is better that the system checks the disks and informs you by email if there is a potential danger. Bash scripts may be written for this and run at specific times as a cron job.</p>
<p style="text-align: justify;">For the GUI, there is a graphical tool called ‘<strong>Baobab</strong>’ for checking the disk usage. It shows how a disk is being used and displays the information in the form of either multicolored concentric rings or boxes.</p>
<h2>Monitoring Memory Usage</h2>
<p style="text-align: justify;">RAM or memory is used to run the current application. Under Linux, there are a number of ways you can check the used memory space -- both in static and dynamic conditions.</p>
<p style="text-align: justify;">For a static snapshot of the memory, use ‘<strong>free -m</strong>’ which results in the output:</p>
<div class="box-content">$ <strong><strong>free -m</strong></strong><br /><strong>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; total&nbsp;&nbsp; used&nbsp;&nbsp; free&nbsp;&nbsp; shared&nbsp;&nbsp; buffers&nbsp; cached</strong>
<p>Mem:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp; &nbsp;&nbsp;&nbsp; 1998 &nbsp;&nbsp; 1896&nbsp;&nbsp;&nbsp; 101&nbsp; &nbsp; 0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; 59&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; 605</p>
<p>-/+ buffers/cache:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 1231&nbsp;&nbsp;&nbsp; 766</p>
<p>Swap:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp; &nbsp;&nbsp; 290&nbsp;&nbsp;&nbsp;&nbsp; 77&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 213</p>
</div>
<p>Here, the total amount of RAM is depicted in megabytes (MB), along with cache and swap. A somewhat more detailed output can be obtained by the command ‘<strong>vmstat</strong>’:</p>
<div class="box-content">root@gateway [~]#&nbsp; <strong>vmstat</strong><br />procs&nbsp;&nbsp; -----------memory-------- --- ---swap--&nbsp; ----io---- &nbsp;&nbsp; --system--&nbsp; -----cpu------<br />&nbsp;r &nbsp;&nbsp; b&nbsp;&nbsp;&nbsp; swpd&nbsp;&nbsp;&nbsp; free&nbsp; &nbsp; buff&nbsp; cache &nbsp;&nbsp; si&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; so &nbsp; &nbsp; &nbsp; &nbsp; bi&nbsp;&nbsp;&nbsp; bo&nbsp; &nbsp; &nbsp; in&nbsp; &nbsp;&nbsp; cs&nbsp;&nbsp;&nbsp; us&nbsp; sy&nbsp; id&nbsp; wa&nbsp; st<br />&nbsp;1 &nbsp;&nbsp; 0&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0&nbsp;&nbsp;&nbsp; 767932&nbsp;&nbsp;&nbsp; 0&nbsp;&nbsp;&nbsp; &nbsp; 0 &nbsp; &nbsp;&nbsp; 0&nbsp; &nbsp; &nbsp; &nbsp; 0&nbsp;&nbsp; &nbsp;&nbsp; &nbsp; &nbsp; 10&nbsp;&nbsp;&nbsp;&nbsp; 3&nbsp; &nbsp; &nbsp; 0&nbsp; &nbsp;&nbsp; 1&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 2&nbsp;&nbsp; 0&nbsp;&nbsp; 97 &nbsp; 0 &nbsp; 0<br />root@gateway [~]#</div>
<p style="text-align: justify;">However, if a dynamic situation of what is happening to the memory is to be examined, you have to use ‘<strong>top</strong>’ or ‘<strong>htop</strong>’. Both will give you a picture of which process is using what amount of memory and the picture will be updated periodically. Both ‘<strong>top</strong>’ and ‘<strong>htop</strong>’ will also show the CPU utilization, tasks running and their PID. Whereas ‘<strong>top</strong>’ has a purely numerical display, ‘<strong>htop</strong>’ is somewhat more colorful and has a semi-graphic look. There is also a list of command menus at the bottom for set up and specific operations.</p>
<div class="box-content" style="text-align: justify;">root@gateway [~]# <strong>top</strong><br /><br />top - 01:04:18 up 81 days, 11:05,&nbsp; 1 user,&nbsp; load average: 0.08, 0.28, 0.33<br />Tasks:&nbsp; 47 total,&nbsp;&nbsp; 1 running,&nbsp; 45 sleeping,&nbsp;&nbsp; 0 stopped,&nbsp;&nbsp; 1 zombie<br />Cpu(s):&nbsp; 2.4%us,&nbsp; 0.4%sy,&nbsp; 0.0%ni, 96.7%id,&nbsp; 0.5%wa,&nbsp; 0.0%hi,&nbsp; 0.0%si,&nbsp; 0.0%st<br />Mem:&nbsp;&nbsp;&nbsp; 1048576k total,&nbsp;&nbsp; 261740k used,&nbsp;&nbsp; 786836k free,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0k buffers<br />Swap:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0k total,&nbsp;&nbsp; &nbsp;&nbsp; &nbsp; 0k used,&nbsp; &nbsp; &nbsp; &nbsp; 0k free,&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; 0k cached<br /><br />&nbsp; PID&nbsp;&nbsp;&nbsp; USER&nbsp;&nbsp;&nbsp;&nbsp; PR&nbsp;&nbsp; NI&nbsp; VIRT&nbsp; RES&nbsp; SHR S&nbsp; %CPU &nbsp; %MEM&nbsp;&nbsp;&nbsp; TIME+ &nbsp;&nbsp; COMMAND&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br />&nbsp;&nbsp;&nbsp; 1&nbsp;&nbsp; root&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 15&nbsp;&nbsp; 0&nbsp; 10372&nbsp; 736&nbsp; 624 S&nbsp; 0.0 &nbsp;&nbsp; 0.1&nbsp; &nbsp;&nbsp; 1:41.86&nbsp;&nbsp; init&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br />&nbsp;5407&nbsp;&nbsp; root&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 18&nbsp;&nbsp; 0&nbsp; 12424&nbsp; 756&nbsp; 544 S&nbsp; 0.0 &nbsp;&nbsp; 0.1&nbsp;&nbsp; &nbsp; 0:13.71&nbsp;&nbsp; dovecot&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br />&nbsp;5408 &nbsp; root&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 15&nbsp;&nbsp; 0&nbsp; 19068 1144&nbsp; 892 S&nbsp; 0.0 &nbsp;&nbsp; 0.1&nbsp;&nbsp;&nbsp;&nbsp; 0:12.09&nbsp;&nbsp; dovecot-auth&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br />&nbsp;5416 &nbsp; dovecot&nbsp;&nbsp; 15&nbsp;&nbsp; 0&nbsp; 38480 2868 2008 S&nbsp; 0.0 &nbsp;&nbsp; 0.3&nbsp;&nbsp; &nbsp; 0:10.80 &nbsp; pop3-login&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br />&nbsp;5417&nbsp;&nbsp; dovecot&nbsp;&nbsp; 15&nbsp;&nbsp; 0&nbsp; 38468 2880 2008 S&nbsp; 0.0 &nbsp;&nbsp; 0.3&nbsp;&nbsp;&nbsp;&nbsp; 0:49.31 &nbsp; pop3-login&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br />&nbsp;5418 &nbsp; dovecot&nbsp;&nbsp; 16&nbsp;&nbsp; 0&nbsp; 38336 2700 2020 S&nbsp; 0.0 &nbsp;&nbsp; 0.3&nbsp; &nbsp;&nbsp; 0:01.15&nbsp;&nbsp; imap-login&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br />&nbsp;5419 &nbsp; dovecot&nbsp;&nbsp; 15&nbsp;&nbsp; 0&nbsp; 38484 2856 2020 S&nbsp; 0.0 &nbsp;&nbsp; 0.3 &nbsp; &nbsp; 0:04.69 &nbsp; imap-login&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br />&nbsp;9745&nbsp;&nbsp; root&nbsp;&nbsp;&nbsp; &nbsp; 18&nbsp;&nbsp; 0&nbsp; 71548&nbsp; 22m 1400 S&nbsp; 0.0 &nbsp;&nbsp; 2.2&nbsp; &nbsp;&nbsp; 0:01.39&nbsp;&nbsp; lfd&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br />11501&nbsp; root&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; 15&nbsp;&nbsp; 0&nbsp;&nbsp; 160m&nbsp; 67m 2824 S&nbsp; 0.0&nbsp; &nbsp; 6.6 &nbsp; &nbsp; 1:32.51&nbsp;&nbsp; spamd&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br />23935&nbsp; firewall &nbsp; 18&nbsp;&nbsp; 0&nbsp; 15276 1180&nbsp; 980 S&nbsp; 0.0&nbsp;&nbsp;&nbsp; 0.1&nbsp; &nbsp;&nbsp; 0:00.00 &nbsp; imap&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br />23948&nbsp; mailnull &nbsp; 15&nbsp;&nbsp; 0&nbsp; 64292 3300 2620 S&nbsp; 0.0 &nbsp;&nbsp; 0.3 &nbsp; &nbsp; 0:05.62&nbsp;&nbsp; exim&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br />23993&nbsp; root&nbsp;&nbsp;&nbsp; &nbsp;&nbsp; 15&nbsp;&nbsp; 0&nbsp;&nbsp; 141m&nbsp; 49m 2760 S&nbsp; 0.0 &nbsp;&nbsp; 4.8&nbsp;&nbsp;&nbsp;&nbsp; 1:00.87 &nbsp; spamd&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br />24477&nbsp; root&nbsp;&nbsp;&nbsp; &nbsp;&nbsp; 18&nbsp;&nbsp; 0&nbsp; 37480 6464 1372 S&nbsp; 0.0 &nbsp;&nbsp; 0.6&nbsp; &nbsp;&nbsp; 0:04.17&nbsp;&nbsp; queueprocd&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br />24494&nbsp; root&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; 18&nbsp;&nbsp; 0&nbsp; 44524 8028 2200 S&nbsp; 0.0 &nbsp;&nbsp; 0.8 &nbsp; &nbsp; 1:20.86&nbsp;&nbsp; tailwatchd&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br />24526&nbsp; root&nbsp;&nbsp;&nbsp; &nbsp;&nbsp; 19&nbsp;&nbsp; 0&nbsp; 92984&nbsp; 14m 1820 S&nbsp; 0.0 &nbsp;&nbsp; 1.4&nbsp;&nbsp;&nbsp;&nbsp; 0:00.00&nbsp;&nbsp; cpdavd&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br />24536&nbsp; root&nbsp;&nbsp; &nbsp; &nbsp; 33&nbsp; 18&nbsp; 23892 2556&nbsp; 680 S&nbsp; 0.0&nbsp;&nbsp;&nbsp; 0.2&nbsp;&nbsp;&nbsp;&nbsp; 0:02.09&nbsp;&nbsp; cpanellogd&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br />24543&nbsp; root&nbsp;&nbsp; &nbsp; &nbsp; 18&nbsp;&nbsp; 0&nbsp; 87692&nbsp; 11m 1400 S&nbsp; 0.0 &nbsp;&nbsp; 1.1&nbsp; &nbsp;&nbsp; 0:33.87 &nbsp; cpsrvd-ssl&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br />25952&nbsp; named&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 22 &nbsp; 0&nbsp;&nbsp; 349m 8052 2076 S&nbsp; 0.0&nbsp;&nbsp;&nbsp; 0.8&nbsp;&nbsp;&nbsp; 20:17.42 &nbsp; named&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br />26374&nbsp; root&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; 15&nbsp; -4&nbsp; 12788&nbsp; 752&nbsp; 440 S&nbsp; 0.0 &nbsp;&nbsp; 0.1 &nbsp;&nbsp;&nbsp; 0:00.00&nbsp;&nbsp; udevd&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br />28031&nbsp; root&nbsp;&nbsp; &nbsp; &nbsp; 17&nbsp;&nbsp; 0&nbsp; 48696 8232 2380 S&nbsp; 0.0 &nbsp;&nbsp; 0.8&nbsp;&nbsp;&nbsp;&nbsp; 0:00.07 &nbsp; leechprotect&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br />28038&nbsp; root&nbsp;&nbsp; &nbsp; &nbsp; 18&nbsp;&nbsp; 0&nbsp; 71992 2172&nbsp; 132 S&nbsp; 0.0 &nbsp;&nbsp; 0.2&nbsp;&nbsp;&nbsp;&nbsp; 0:00.00&nbsp;&nbsp; httpd&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br />28524&nbsp; root&nbsp;&nbsp; &nbsp; &nbsp; 18&nbsp;&nbsp; 0&nbsp; 90944 3304 2584 S&nbsp; 0.0&nbsp;&nbsp;&nbsp; 0.3&nbsp; &nbsp;&nbsp; 0:00.01&nbsp;&nbsp; sshd</div>
<p style="text-align: justify;">For a graphical display of how the memory is being utilized, the Gnome System Monitor gives a detailed picture. There are other system monitors available under various window managers in Linux.</p>
<h2 style="text-align: justify;">Monitoring CPU(s)</h2>
<p style="text-align: justify;">You may have a single, a dual core, or a quad core CPU in your system. To see what each CPU is doing or how two CPUs are sharing the load, you have to use ‘<strong>top</strong>’ or ‘<strong>htop</strong>’. These command line applications show the percentage of each CPU being utilized. You can also see process statistics, memory utilization, uptime, load average, CPU status, process counts, and memory and swap space utilization statistics.</p>
<p style="text-align: justify;">Similar output statistics may be seen by using command line tools such as the ‘<strong>mpstat</strong>’, which is part of a group package called ‘<strong>sysstat</strong>’. You may have to install ‘<strong>sysstat</strong>’ in your system, since it may not be installed by default. Once installed, you can monitor a variety of parameters, for example compare the CPU utilization of an SMP system or multi-processor system.</p>
<p style="text-align: justify;">Finding out if any specific process is hogging the CPU needs a little more command line instruction such as:</p>
<div class="box-content" style="text-align: justify;">$ <strong>ps -eo pcpu,pid,user,args | sort -r -k1 | less</strong></div>
<p style="text-align: justify;">OR</p>
<div class="box-content" style="text-align: justify;">$ <strong>ps -eo pcpu,pid,user,args | sort -k 1 -r | head -10</strong></div>
<p style="text-align: justify;">Similar output can be obtained by using the command ‘<strong>iostat</strong>’ as root:</p>
<div class="box-content" style="text-align: justify;">root@gateway [~]# <strong>iostat -xtc 5 3</strong><br />Linux 2.6.18-028stab094.3 (gateway.firewall.cx)&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 01/11/2012<br /><br />Time: 01:13:15 AM<br />avg-cpu:&nbsp; %user&nbsp;&nbsp; %nice &nbsp; %system&nbsp; %iowait&nbsp; %steal&nbsp;&nbsp; %idle<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp; 2.38&nbsp;&nbsp;&nbsp; 0.01 &nbsp; &nbsp; 0.43&nbsp; &nbsp;&nbsp; 0.46 &nbsp;&nbsp; 0.00&nbsp;&nbsp; &nbsp; 96.72<br /><br />Time: 01:13:20 AM<br />avg-cpu:&nbsp; %user&nbsp;&nbsp; %nice &nbsp; %system&nbsp; %iowait&nbsp; %steal&nbsp;&nbsp; %idle<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp; 3.89&nbsp;&nbsp;&nbsp; 0.00&nbsp; &nbsp;&nbsp; 0.26&nbsp;&nbsp;&nbsp;&nbsp; 0.09&nbsp; &nbsp;&nbsp; 0.00&nbsp;&nbsp;&nbsp;&nbsp; 95.77<br /><br />Time: 01:13:25 AM<br />avg-cpu:&nbsp; %user&nbsp;&nbsp; %nice &nbsp; %system&nbsp; %iowait&nbsp; %steal&nbsp;&nbsp; %idle<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 0.31&nbsp;&nbsp;&nbsp; 0.00&nbsp;&nbsp;&nbsp; 0.15 &nbsp; &nbsp;&nbsp; 1.07&nbsp;&nbsp;&nbsp;&nbsp; 0.00&nbsp;&nbsp;&nbsp;&nbsp; 98.47<strong><br style="text-align: justify;" /></strong></div>
<p style="text-align: justify;">This will show three outputs every five seconds and show the information since the last reboot.</p>
<p style="text-align: justify;">CPU usage under GUI is very well depicted by the Gnome System Monitor and other system monitoring applications. These are also useful for monitoring remote servers. Detailed memory maps can be accessed, signals can be sent and processes controlled remotely.</p>
<h4><img src="https://www.firewall.cx/images/stories/linux-system-monitoring-1.png" alt="linux-system-monitoring-1" width="599" height="468" style="display: block; margin-left: auto; margin-right: auto;" /></h4>
<p style="text-align: center;">Gnome-System-Monitor</p>
<h2>Linux Processes</h2>
<p style="text-align: justify;">How do you know what processes are currently running in your Linux system? There are innumerable ways of getting to see this information. The handiest applications are the old faithfuls - ‘<strong>top</strong>’ and ‘<strong>htop</strong>’. They will give a real-time image of what is going on under the hood. However, if you prefer a more static view, use ‘<strong>ps</strong>’. To see all processes try ‘<strong>ps -A’</strong> or ‘<strong>ps -e</strong>’:</p>
<p class="box-content">root@gateway [~]# <strong>ps -e</strong><br /> PID TTY&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; TIME CMD<br />&nbsp;&nbsp;&nbsp; 1 ?&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; 00:01:41 init<br />&nbsp;3201 ?&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 00:00:00 leechprotect<br />&nbsp;3208 ?&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 00:00:00 httpd<br />&nbsp;3360 ?&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 00:00:00 httpd<br />&nbsp;3490 ?&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 00:00:00 httpd<br />&nbsp;3530 ?&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 00:00:00 httpd<br />&nbsp;3532 ?&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 00:00:00 httpd<br />&nbsp;3533 ?&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 00:00:00 httpd<br />&nbsp;3535 ?&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 00:00:00 httpd<br />&nbsp;3575 ?&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 00:00:00 httpd<br />&nbsp;3576 ?&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 00:00:00 httpd<br />&nbsp;3631 ?&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 00:00:00 imap<br />&nbsp;3694 ?&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 00:00:00 httpd<br />&nbsp;3705 ?&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 00:00:00 httpd<br />&nbsp;3770 ?&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 00:00:00 imap<br />&nbsp;3774 pts/0&nbsp;&nbsp;&nbsp; 00:00:00 ps<br />&nbsp;5407 ?&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 00:00:13 dovecot<br />&nbsp;5408 ?&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 00:00:12 dovecot-auth<br />&nbsp;5416 ?&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 00:00:10 pop3-login<br />&nbsp;5417 ?&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 00:00:49 pop3-login<br />&nbsp;5418 ?&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 00:00:01 imap-login<br />&nbsp;5419 ?&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 00:00:04 imap-login<br />&nbsp;9745 ?&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 00:00:01 lfd<br />11501 ?&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 00:01:35 spamd<br />23948 ?&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 00:00:05 exim<br />23993 ?&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 00:01:00 spamd<br />24477 ?&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 00:00:04 queueprocd<br />24494 ?&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 00:01:20 tailwatchd<br />24526 ?&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 00:00:00 cpdavd<br />24536 ?&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 00:00:02 cpanellogd<br />24543 ?&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 00:00:33 cpsrvd-ssl<br />25952 ?&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 00:20:17 named<br />26374 ?&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 00:00:00 udevd<br />28524 ?&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 00:00:00 sshd<br />28531 pts/0&nbsp;&nbsp;&nbsp; 00:00:00 bash<br />29834 ?&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 00:00:00 sshd<br />30426 ?&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 00:11:27 syslogd<br />30429 ?&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 00:00:00 klogd<br />30473 ?&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 00:00:00 xinetd<br />30485 ?&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 00:00:00 mysqld_safe<br />30549 ?&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 1-15:07:28 mysqld<br />32158 ?&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 00:06:29 httpd<br />32166 ?&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 00:12:39 pure-ftpd<br />32168 ?&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 00:07:12 pure-authd<br />32181 ?&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 00:01:06 crond<br />32368 ?&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 00:00:00 saslauthd<br />32373 ?&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 00:00:00 saslauthd</p>
<p><strong>PS</strong> is an extremely powerful and versatile command, and you can learn more by ‘<strong>ps --h</strong>’:</p>
<p class="box-content">root@gateway [~]# <strong>ps --h<br /></strong>********* simple selection *********&nbsp; ********* selection by list *********<br />-A all processes&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; &nbsp; -C by command name<br />-N negate selection&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; -G by real group ID (supports names)<br />-a all w/ tty except session leaders&nbsp;&nbsp;&nbsp;&nbsp; -U by real user ID (supports names)<br />-d all except session leaders&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; -g by session OR by effective group name<br />-e all processes&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; &nbsp;&nbsp;&nbsp; -p by process ID<br />T&nbsp; all processes on this terminal&nbsp;&nbsp; &nbsp;&nbsp; &nbsp; -s processes in the sessions given<br />a&nbsp; all w/ tty, including other users &nbsp;&nbsp;&nbsp; -t by tty<br />g&nbsp; OBSOLETE -- DO NOT USE&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&nbsp;&nbsp; -u by effective user ID (supports names)<br />r&nbsp; only running processes&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; &nbsp;&nbsp; &nbsp; U&nbsp; processes for specified users<br />x&nbsp; processes w/o controlling ttys&nbsp;&nbsp;&nbsp; &nbsp; &nbsp;&nbsp; t&nbsp; by tty<br />*********** output format **********&nbsp; *********** long options ***********<br />-o,o user-defined &nbsp; -f full&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; &nbsp;&nbsp;&nbsp;&nbsp; --Group --User --pid --cols --ppid<br />-j,j job control&nbsp; &nbsp; s&nbsp; signal&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; --group --user --sid --rows --info<br />-O,O preloaded&nbsp;&nbsp;&nbsp;&nbsp; -o&nbsp; v&nbsp; virtual memory&nbsp; --cumulative --format --deselect<br />-l,l long&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; &nbsp; &nbsp;&nbsp; u&nbsp; user-oriented&nbsp;&nbsp; --sort --tty --forest --version<br />-F&nbsp;&nbsp; extra full&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; X&nbsp; registers&nbsp;&nbsp;&nbsp; &nbsp;&nbsp; --heading --no-heading --context<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ********* misc options *********<br />-V,V&nbsp; show version&nbsp;&nbsp; &nbsp; L&nbsp; list format codes &nbsp; f&nbsp; ASCII art forest<br />-m,m,-L,-T,H&nbsp; threads&nbsp; S&nbsp; children in sum &nbsp;&nbsp; -y change -l format<br />-M,Z&nbsp; security data&nbsp; &nbsp; c&nbsp; true command name&nbsp; -c scheduling class<br />-w,w&nbsp; wide output&nbsp;&nbsp;&nbsp; &nbsp; n&nbsp; numeric WCHAN,UID&nbsp; -H process hierarchy<strong><br /></strong></p>]]></description>
			<category>Linux - Unix</category>
			<pubDate>Wed, 11 Jan 2012 09:27:04 +1100</pubDate>
		</item>
		<item>
			<title>Linux VIM / Vi Editor - Tutorial - Basic &amp; Advanced Features</title>
			<link>https://www.firewall.cx/operating-systems/linux-unix/linux-vi.html</link>
			<guid isPermaLink="true">https://www.firewall.cx/operating-systems/linux-unix/linux-vi.html</guid>
			<description><![CDATA[<p>When you are using <strong>Vim</strong>, you want to know three things - getting in, moving about and getting out. Of course, while doing these three basic operations, you would like to do something meaningful as well. So, we start with getting into Vim.</p>
<p>Assuming that you are in a shell, or in the command line, you can simply type 'vim' and the application starts:</p>
<div class="box-content">root@gateway [~]# <strong>vim</strong></div>
<p>&nbsp;Exiting the VIM application is easily accomplished: type '<strong>:</strong>' followed by a '<strong>q</strong>', hit the '<strong>Enter</strong>' key and you are out:</p>
<div class="box-content">~<br />~&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; VIM - Vi IMproved<br />~<br />~&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; version 7.0.237<br />~&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; by Bram Moolenaar et al.<br />~&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Modified by &lt;bugzilla@redhat.com&gt;<br />~&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Vim is open source and freely distributable<br />~<br />~&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Become a registered Vim user!<br />~&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; type&nbsp; :help register&lt;Enter&gt;&nbsp;&nbsp; for information <br />~<br />~&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; type&nbsp; :q&lt;Enter&gt;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; to exit&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br />~&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; type&nbsp; :help&lt;Enter&gt;&nbsp; or&nbsp; &lt;F1&gt;&nbsp; for on-line help<br />~&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; type&nbsp; :help version7&lt;Enter&gt;&nbsp;&nbsp; for version info<br />~<br /><strong>:q</strong><br />root@gateway [~]#</div>
<p style="text-align: justify;">&nbsp;That's how you start and stop the Vim car. Now, let's try to learn how to steer the car.</p>
<p style="text-align: justify;">You can move around in Vim, using the four arrow keys. However, a faster way is to use the '<strong>h</strong>', '<strong>j</strong>', '<strong>k</strong>' and '<strong>l</strong>' keys. This is because the keys are always under your right hand and you do not need to move your hand to access them as with the arrow keys. The '<strong>j</strong>' moves the cursor <strong>down</strong>, '<strong>k</strong>' moves it <strong>up</strong>. The '<strong>h</strong>' key moves the cursor <strong>left</strong>, while '<strong>l</strong>' moves it to the <strong>right</strong>. That's how you steer the Vim car.</p>
<p style="text-align: justify;">You can edit a file using Vim. You either have an existing file, or you make a new one. If you start with '<strong>vim <em>filename</em></strong>', you edit the file represented by the '<em>filename</em>'. If the file does not exist, Vim will create a new file. Now, if you want to edit a file from within Vim, open the file using '<strong>:e <em>filename</em></strong>'. If this file is a new file, Vim will inform you. You can save the file using the '<strong>:w</strong>' command.</p>
<p style="text-align: justify;">If you need to search the file you are editing for a specific word or string, simply type forward-slash '<strong>/</strong>' followed by the word you would like to search for. After hitting 'enter', VIM will automatically take you to the first match.&nbsp; By typing forward-slash '<strong>/</strong>' again followed by 'enter' it will take you to the next match.</p>
<p style="text-align: justify;">To write or edit something inside the file, you can start by typing '<strong>:i</strong>' and Vim will enter the '<strong>Insert</strong>' mode. Once you have finished, you can exit the Insert mode by pressing the '<strong>Esc</strong>' key, and undo the changes you made with '<strong>:e!</strong>'. You also have a choice to either save the file using the '<strong>:w</strong>' command, or save &amp; quit by using '<strong>:wq</strong>'. Optionally, you can abort the changes and quit by '<strong>:q!</strong>'.</p>
<p style="text-align: justify;">If you have made a change and want to quit without explicitly informing Vim whether you want to save the file or not, Vim will rightly complain, but will also guide you to use the '<strong>!</strong>'.</p>
<h2 style="text-align: justify;">Command Summary</h2>
<p>Start VIM:&nbsp; <strong>vim</strong><br />Quit Program: :<strong>q</strong><br />Move Cursor: <strong>Arrow</strong> keys or <strong>j</strong>, <strong>k</strong>, <strong>h</strong>,<strong> l</strong> (down, up, left, right)<br />Edit file: <strong>vim <em>filename</em></strong><br />Open file (within VIM):&nbsp; <strong>:e <em>filename&nbsp; e.g&nbsp;&nbsp; :e bash.rc<br /></em></strong>Search within file: <strong>/'<em>string</em>'&nbsp; e.g /firewall &nbsp;<em><br /></em></strong>Insert mode:&nbsp; <strong>:i<em><br /></em></strong>Save file:&nbsp;&nbsp; <strong>:w</strong><br />Save and Quit:&nbsp; <strong>:wq</strong><br />Abort and Quit:&nbsp; <strong>:q!</strong></p>
<h2>Advanced Features of VIM</h2>
<p style="text-align: justify;">Now that you know your way in and out of Vim, and how to edit a file, let us dig a little deeper. For example, how can you add something at the end of a line, when you are at its starting point? Well, one way is to keep the right arrow pressed, until you get to the end. A faster way is '<strong>Shift+a</strong>' and you are at the end of the line. To go to the beginning of the line, you must press '<strong>Shift+i</strong>'. Make sure you are out of the 'Insert' mode shown at the bottom; use the '<strong>Esc</strong>' for this.</p>
<p style="text-align: justify;">Supposing you are in the middle of a line, and would like to start inserting text into a new line, just below it. One way would be to move the cursor right and hit 'Enter' when you reach the end. A faster way is to enter '<strong>o</strong>'. If you enter '<strong>o</strong>' or '<strong>shift+o</strong>', you can start entering text into the new line created above the cursor. Don't forget to exit the 'Insert' mode by pressing '<strong>Esc</strong>'.</p>
<p style="text-align: justify;">How do you delete lines? Hold the '<strong>delete</strong>' button and wait until the lines are gone. How can you do it faster? Use the '<strong>d</strong>' command. If you want to delete 10 lines below your cursor position and the current line, try '<strong>d10j</strong>'. To delete 5 lines above your current position and the current line, try '<strong>d5k</strong>'. Note the '<strong>j</strong>' and '<strong>k</strong>' (down, up) covered in our previous section. If you’ve made a mistake, recover it with the undo command, '<strong>u</strong>'. Redo it with '<strong>Ctrl+r</strong>'.</p>
<p style="text-align: justify;">Tip 1: To delete the current line alone, use '<strong>dd</strong>'.</p>
<p style="text-align: justify;">Tip 2: To delete the current line and the one below it, use '<strong>d2d</strong>'.</p>
<p style="text-align: justify;">Did you know you can have windows in Vim? Oh yes, you can. Try '<strong>Ctrl+w+s</strong>' if you want a horizontal split, and '<strong>Ctrl+w+v</strong>' if you want a vertical split. Move from one window to another by using '<strong>Ctrl+w+w</strong>'. After you have finished traveling through all the windows, close them one by one using '<strong>Ctrl+w+c</strong>'.</p>
<p style="text-align: justify;">&nbsp;Here is an example with four (4) windows within the Vim environment:</p>
<p><img src="https://www.firewall.cx/images/stories/linux-vim-editor-1.jpg" alt="linux-vim-editor-1" width="498" height="323" style="display: block; margin-left: auto; margin-right: auto;" /></p>
<p style="text-align: justify;">You can record macros in Vim and run them. To record a macro you have to start it with an '<strong>m</strong>'. To stop recording it, hit '<strong>q</strong>'. To play the macro, press '<strong>@m</strong>'. To rerun it, press '<strong>@</strong>'. Macros are most useful when you require to perform the same commands within a file.</p>
<p style="text-align: justify;">Vim also has extensive help facilities. To learn about a command, say '<strong>e</strong>', type '<strong>:h e</strong>' and hit '<strong>Enter</strong>'. You will see how the command '<strong>e</strong>' can be useful. To come back to where you were, type ‘<strong>:q</strong>’ and then ‘<strong>Enter</strong>’. Incidentally, typing '<strong>:he</strong>' and '<strong>Enter</strong>' will open up the general help section. Come back with the same '<strong>:q</strong>'.</p>
<p style="text-align: justify;">As an example, here's what we got when we typed '<strong>:h e</strong>' (that's an "<strong>:</strong>" + "<strong>h</strong>" + space + "<strong>e</strong>"):</p>
<p><span style="color: #ff0000;"><img src="https://www.firewall.cx/images/stories/linux-vim-editor-2.png" alt="linux-vim-editor-2" width="669" height="426" style="display: block; margin-left: auto; margin-right: auto;" /></span></p>
<p>When we typed '<strong>:he</strong>', we were presented with the main help file of VIM:</p>
<p><span style="color: #ff0000;"><img src="https://www.firewall.cx/images/stories/linux-vim-editor-3.png" alt="linux-vim-editor-3" width="670" height="430" style="display: block; margin-left: auto; margin-right: auto;" /><br /></span></p>
<h2>Command Summary</h2>
<p>Move cursor to end of line:&nbsp; <strong>Shift+a</strong><br />Move cursor to beginning of line:&nbsp; <strong>Shift+o</strong><br />Delete current line: <strong>dd</strong><br />Delete 10 lines below cursor position: <strong>d10j</strong><br />Delete 5 lines above cursor position: <strong>d5k</strong><br />Undo:&nbsp; <strong>u</strong><br />Redo: <strong>Ctrl+r</strong><br />Window Mode - Horizontal<strong>:&nbsp; Ctrl+w+s</strong><br />Window Mode - Vertical Split:&nbsp; <strong>Ctrl+w+v</strong><br />Move between windows: <strong>Ctrl+w+w</strong><br />Close Window: <strong>Ctrl+w+c</strong><br />Enable Macro recording:&nbsp; <strong>m</strong><br />Play Macro:&nbsp; <strong>@m</strong><br />Help:&nbsp;&nbsp;&nbsp; <strong>:h</strong> '<strong>command</strong>'&nbsp; from within VIM. e.g&nbsp; <strong>:h e<br /></strong></p>
<p><br /><br /></p>]]></description>
			<category>Linux - Unix</category>
			<pubDate>Tue, 27 Dec 2011 09:15:23 +1100</pubDate>
		</item>
		<item>
			<title>Linux BIND DNS - Part 6: Linux BIND - DNS Caching</title>
			<link>https://www.firewall.cx/operating-systems/linux-unix/linux-bind-caching.html</link>
			<guid isPermaLink="true">https://www.firewall.cx/operating-systems/linux-unix/linux-bind-caching.html</guid>
			<description><![CDATA[<p style="text-align: justify;" align="left">In the previous articles, we spoke about the Internet Domain Hierarchy and explained how the ROOT servers are the DNS servers, which contain all the information about authoritative DNS servers the domains immediately below e.g firewall.cx, microsoft.com. In fact, when a request is passed to any of the ROOT DNS servers, they will redirect the client to the appropriate <strong><em>authoritative</em> DNS server, </strong> that is, the DNS server in charge of the domain.</p>
<p style="text-align: justify;" align="left">For example, if you're trying to resolve firewall.cx and your machine contacts a ROOT DNS server, the server will point your computer to the DNS server in charge of the .CX domain, which in turn will point your computer to the DNS server in charge of firewall.cx, currently server with IP 74.200.90.5.</p>
<h2>Understanding DNS Caching and its Implications</h2>
<p style="text-align: justify;" align="left">As you can see, a simple DNS request can become quite a task in order to successfully resolve the domain. This also means that there's a fair bit of traffic generated in order to complete the procedure. Whether you're paying a flat rate to your ISP or your company has a permanent connection to the Internet, the truth is that someone ends up paying for all these DNS requests ! The above example was only for one computer trying to resolve one domain. Try to imagine a company that has 500 computers connected to the Internet or an ISP with 150,000 subscribers - Now you're starting to get the big picture!</p>
<p style="text-align: justify;" align="left">All that traffic is going to end up on the Internet if something isn't done about it, not to mention who will be paying for it!</p>
<p style="text-align: justify;" align="left">This is where DNS Caching comes in. If we're able to cache all these requests, then we don't need to ask the ROOT DNS or any other external DNS server as long as we are trying to resolve previously visited sites or domains, because our caching system would "remember" all the previous domains we visited (and therefore resolved) and would be able to give us the IP Address we're looking for!</p>
<p style="text-align: justify;" align="left">Note: You should keep in mind that when you install BIND, by default it's setup to be a DNS Caching server, so all you need to do it startup the service, which is called 'named'.</p>
<p style="text-align: justify;" align="left">Almost all Internet name servers use name caching to optimise search costs. Each of these servers maintains a cache which contains all recently used names as well as a record of where the mapping information for that name was obtained. When a client (e.g your computer) asks the server to resolve a domain, the server will first check to see whether it has authority (meaning if it is in charge) for that domain. If not, the server checks its cache to see if the domain is in there and it will find it if it's been recently resolved.</p>
<p style="text-align: justify;" align="left">Assuming that the server does find it in the cache, it will take the information and pass it on to the client but also mark the information as a <em>nonauthoritative</em> binding, which means the server tells the client "Here is the information you required, but keep in mind, I am not in charge of this domain".</p>
<p style="text-align: justify;" align="left">The information can be out of date and, if it is critical for the client that it does not receive such information, it will then try to contact the authoritative DNS server for the domain and obtain the up to date information it requires.</p>
<h2>DNS Caching Does Come with its Problems!</h2>
<p style="text-align: justify;" align="left">As you can clearly see, DNS caching can save you a lot of money, but it comes with its problems !</p>
<p style="text-align: justify;" align="left">Caching does work well in the domain name system because name to address binding changes infrequently. However, it does change. If the servers cached the information the first time it was requested and never change that information, the entries in the cache could become incorrect.</p>
<h2>The Solution To DNS Caching Problems</h2>
<p style="text-align: justify;" align="left">Fortunately there is a solution that will prevent DNS servers from giving out incorrect information. To ensure that the information in the cache is correct, every DNS server will time each entry and dispose of the ones that have exceeded a reasonable time. When a DNS server is asked for the information after it has removed the entry from its cache, it must go back to the authoritative source and obtain it again.</p>
<p style="text-align: justify;" align="left">Whenever an authoritative DNS server responds to a request, it includes a <strong>Time To Live</strong> (TTL) value in the response. This <strong>TTL </strong>value is set in the zone files as you've probably already seen in the previous pages.</p>
<p style="text-align: justify;" align="left">If you manage DNS server an are planning to introduce changes like redelegate (move) your domain to some other hosting company or if the IP Address your website currently has or changing mail servers, in the next couple weeks, then it's a good idea to get your TTL changes to a very small value well before the scheduled changes. Reason for this is because any dns server that will query your domain, website or any resource record that belongs to your domain, will cache the data for the amount of time the TTL is set.</p>
<p style="text-align: justify;" align="left">By decreasing the <strong>$TTL</strong> value to e.g 1 hour, this will ensure that all dns data from your domain will expire in the requesters cache 1 hour after it was received. If you didn't do this, then the servers and clients (simple home users) who access your site or domain, will cache the dns data for the currently set time, which is normaly around 3 days. Not a good thing when you make a big change :)</p>
<p style="text-align: justify;" align="left">So keep in mind all the above when your about the perform a change in the DNS server zone files. a couple of days before making the change, decrease the <strong>$TTL</strong> value to a reasonable value, not more than a few hours, and then once you complete the change, be sure you set it back to what it was.</p>
<p style="text-align: justify;" align="left">We hope this has given you an insight on how you can save yourself, or company money and problems which occur when changing field and values in the DNS zone files!</p>]]></description>
			<category>Linux - Unix</category>
			<pubDate>Sun, 18 Dec 2011 08:00:00 +1100</pubDate>
		</item>
		<item>
			<title>Linux BIND DNS - Part 5: Configure Secondary (Slave) DNS Server</title>
			<link>https://www.firewall.cx/operating-systems/linux-unix/linux-bind-slave-dns.html</link>
			<guid isPermaLink="true">https://www.firewall.cx/operating-systems/linux-unix/linux-bind-slave-dns.html</guid>
			<description><![CDATA[<p>Setting up a <strong>Secondary (or Slave) DNS sever</strong> is much easier than you might think. All the hard work is done when you setup the <strong>Master DNS server</strong> by creating your <a href="https://www.firewall.cx/operating-systems/linux-unix/linux-bind-domain-zone-file.html" target="_blank" title="database zone files">database zone files</a> and configuring the <a href="https://www.firewall.cx/operating-systems/linux-unix/linux-bind-common-files.html" target="_blank" title="named.conf">named.conf</a> file.</p>
<p style="text-align: justify;" align="left">If you are wondering how is it that the Slave DNS server is easy to setup, well you need to remember that all the Slave DNS server does is update its database from the Master DNS server (<em>zone transfer</em>) so almost all the files we configure on the Master DNS server are copied to the Slave DNS server, which acts as a backup in case the Master DNS server fails.</p>
<h2>Setting Up The Slave DNS Server</h2>
<p style="text-align: justify;" align="left">Let's have a closer look at the requirements for getting our Slave DNS server up and running.</p>
<p style="text-align: justify;" align="left">Keeping in mind that the Slave DNS server is on another machine, we are assuming that you have downloaded and successfully installed the same BIND version on it. We need to copy 3 files from the Master DNS server, make some minor modifications to one file and launch our Slave DNS server.... the rest will happen automatically :)</p>
<h3>So which files do we copy?</h3>
<p style="text-align: justify;" align="left">The files required are the following:</p>
<ul style="text-align: justify;">
<li><strong>named.conf</strong> (our configuration file)</li>
<li><strong>named.ca</strong> or <strong>db.cache</strong> (the root hints file, contains all root servers)</li>
<li><strong>named.local</strong> (local loopback for the specific DNS server so it can direct traffic to itself)</li>
</ul>
<p style="text-align: justify;">The rest of the files, which are our <strong><em>db.DOMAIN</em></strong> (db.firewall.cx for our example) and <strong><em>db.in-addr.arpa </em></strong>(db.192.168.0 for our example), will be transferred automatically (zone transfer) as soon as the newly brought up Slave DNS server contacts the Master DNS server to check for any zone files.</p>
<h3>How do I copy these files?</h3>
<p style="text-align: justify;">There are plenty of ways to copy the files between servers. The method you will use depends on where the servers are located. If, for example, they are right next to you, you can simply use a floppy disk to copy them or use ftp to transfer them.</p>
<p style="text-align: justify;">If you're going to try to transfer them over a network, and especially over the Internet, then you might consider something more secure than ftp. We would recommend you use SCP, which stands for Secure Copy and uses SSH (Secure SHell).</p>
<p style="text-align: justify;"><strong>SCP </strong>can be used independently of SSH as long as there is an SSH server on the other side. <strong>SCP </strong>will allow you to transfer files over an encrypted connection and therefore is preferred for sensitive files, plus you get to learn a new command :)</p>
<p style="text-align: justify;">The command used is as follows:<strong> <em>scp localfile-to-copy username@remotehost:desitnation-folder</em></strong>. Here is the command line we used from our Gateway server (Master DNS): <strong><em>scp /etc/named.conf root@voyager:/etc/</em></strong></p>
<p style="text-align: justify;">Keep in mind that the files we copy are placed in the same directory as on the Master DNS server. Once we have copied all three files we need to modify the <strong>named.conf</strong> file. To make things simple, we are going to show you the original file copied from the Master DNS and the modified version which now sits on the Slave DNS server.</p>
<p style="text-align: justify;">The <strong>Master named.conf</strong> file is a clear cut/paste from the "<a href="https://www.firewall.cx//linux-knowledgebase-tutorials/system-and-network-services/832-linux-bind-common-files.html" target="_blank">Common BIND Files</a>" page, whereas the <strong>Slave named.conf</strong> has been modifed to suit our Slave DNS server. To help you identify the changes, we have marked them in red:</p>
<table border="2" style="border-width: 2px; border-style: solid; width: 565px; height: 551px;" cellpadding="5" align="center">
<tbody>
<tr>
<td>
<p align="center"><strong>Master named.conf file</strong></p>
<p align="left">options {<br /> directory "/var/named";<br /> <br /> };</p>
<p align="left"><br /> // Root Servers <br /> zone "." IN {<br /> type hint;<br /> file "named.ca";<br /> };</p>
<p>// Entry for Firewall.cx - name to ip mapping<br /> zone "firewall.cx" IN {<br /> type master;<br /> file "db.firewall.cx";<br /> };</p>
<p><br /> // Entry for firewall.cx - ip to name mapping<br /> zone "0.168.192.in-addr.arpa" IN {<br /> type master;<br /> file "db.192.168.0";<br /> };</p>
<p>// Entry for Local Loopback<br /> zone "0.0.127.in-addr.arpa" IN {<br /> type master;<br /> file "named.local";<br /> };</p>
</td>
<td>&nbsp;
<p align="center"><strong>Slave named.conf file</strong></p>
<p align="left">options {<br /> directory "/var/named";</p>
<p align="left">};</p>
<p align="left"><br /> // Root Servers<br /> zone "." IN {<br /> type hint;<br /> file "named.ca";<br /> };</p>
<p align="left">// Entry for Firewall.cx - name to ip mapping<br /> zone "firewall.cx" IN {<br /> type <span style="color: #ff0000;">slave</span>;<br /> file "<span style="color: #ff0000;">bak</span>.firewall.cx";<br /> <span style="color: #ff0000;">masters { 192.168.0.10 ; } ;</span><br /> };</p>
<p align="left">// Entry for firewall.cx - ip to name mapping<br /> zone "0.168.192.in-addr.arpa" IN {<br /> type <span style="color: #ff0000;">slave</span>;<br /> file "bak.192.168.0";<br /> <span style="color: #ff0000;">masters { 192.168.0.10 ; } ;</span><br /> };</p>
<p align="left">// Entry for Local Loopback<br /> zone "0.0.127.in-addr.arpa" IN {<br /> type master;<br /> file "named.local";<br /> };</p>
</td>
</tr>
</tbody>
</table>
<p style="text-align: justify;">&nbsp;As you can see, most of the slave's <strong>named.conf</strong> file is similair to the master's, except for a few fields and values, which we are going to explain right now.</p>
<p style="text-align: justify;">The <strong>type</strong> value is now <strong>slave</strong>, and that's pretty logical since it tells the dns server if it's a master or slave.</p>
<p style="text-align: justify;">The file "<strong>bak</strong><strong>.firewall.cx</strong>"; entry basically tells the server what name to give the zone files once they are transfered from the master dns server. We tend to follow the <strong> bak.domain</strong> format because that's the way we see the slave server, a backup dns server. It is not imperative to use this name scheme, you can change it to whatever you wish. Once the server is up and running, you will see these files soon appear in the <strong>/var/named</strong> directory.</p>
<p style="text-align: justify;">Lastly, the <strong>masters {192.168.0.10};</strong> entry informs our slave server that this is the IP Address of the master DNS which it needs to contact and retrieve the zone files. That's all there is to setup the slave DNS server ! As we mentioned, once the master is setup, the slave is a peice of cake cause it involves very few changes.</p>
<p style="text-align: justify;">Our Final article covers the setup of&nbsp; <a href="https://www.firewall.cx/operating-systems/linux-unix/linux-bind-caching.html" title="Linux BIND DNS Caching">Linux BIND DNS Caching</a>. </p>]]></description>
			<category>Linux - Unix</category>
			<pubDate>Sun, 18 Dec 2011 08:00:00 +1100</pubDate>
		</item>
		<item>
			<title>Linux BIND DNS - Part 4: Common BIND Files - Named.local, named.conf, db.127.0.0 etc </title>
			<link>https://www.firewall.cx/operating-systems/linux-unix/linux-bind-common-files.html</link>
			<guid isPermaLink="true">https://www.firewall.cx/operating-systems/linux-unix/linux-bind-common-files.html</guid>
			<description><![CDATA[<p style="text-align: justify;" align="left">So far we have covered in great detail the main files required for the firewall.cx domain. These files, which we named db.firewall.cx and db.192.168.0, define all the resouce records and hosts available in the firewall.cx domain.</p>
<p style="text-align: justify;" align="left">We will be analysing these files in this article, to help you understand why they exist and how they fit into the big picture :</p>
<h2 style="text-align: justify;" align="left">Our Common Files</h2>
<p style="text-align: justify;" align="left">There are 3 common files that we're going to look at, of which the first two files contents change slightly depending on the domain. This happens because they must be aware of the various hosts and the domain name for which they are created. The third file in the list below, is always the same amongst all DNS servers and we will explain more about it later on.</p>
<p style="text-align: justify;" align="left">So here are our files:</p>
<ul style="text-align: justify;">
<li><strong>named.local or db.127.0.0</strong></li>
<li><strong>named.conf</strong></li>
<li><strong>named.ca or db.cache</strong></li>
</ul>
<h2>The Named.local File</h2>
<p style="text-align: justify;">The<strong> named.local</strong> file, or <strong>db.127.0.0</strong> as some might call it, is used to cover the loopback network. Since no one was given the responsibility for the 127.0.0.0 network, we need this file to make sure there are no errors when the DNS server needs to direct traffic to itself (127.0.0.1 IP Address - Loopback).</p>
<p style="text-align: justify;">When installing BIND, you will find this file in your caching example directory:<strong> /var/named/<em>caching-example</em></strong>, so you can either create a new one or modify the existing one to meet your requirements.</p>
<p style="text-align: justify;">The file is no different than our example db.addr file we saw previously:</p>
<div class="box-content" style="text-align: justify;">$TTL 86400
<p>0.0.127.in-addr.arpa. IN SOA voyager.firewall.cx. admin.firewall.cx. (</p>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 1 ; Serial<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 3h ; Refresh after 3 hours <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 1h ; Retry after 1 hour <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 1w ; Expire after 1 week <br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 1h ) ; Negative caching TTL of 1 hour
<p>&nbsp;</p>
0.0.127.in-addr.arpa. IN NS voyager.firewall.cx. <br />0.0.127.in-addr.arpa. IN NS gateway.firewall.cx.<br />1.0.0.127.in-addr.arpa. IN PTR localhost.</div>
<p style="text-align: justify;">That's all there is for <strong>named.local</strong> file !</p>
<h2>The Named.ca File</h2>
<p style="text-align: justify;" align="left">The <strong>named.ca</strong> file (also known as the "root hints file") is created when you install BIND and dosen't need to be modified unless you have an old version of BIND or it's been a while since you installed BIND.</p>
<p style="text-align: justify;" align="left">The purpose of this file is to let your DNS server know about the Internet ROOT Servers. There is no point displaying all of the file's content because it's quite big, so we will show an entry of a ROOT server to get the idea what it looks like:</p>
<div style="text-align: justify;" align="left"><em class="box-content">; last update: Aug 22, 2011<br /><em>; related version of root zone: 1997082200</em><br /><em>; formerly NS.INTERNIC.NET</em><br /><br /><em>. 3600000 IN NS A.ROOT-SERVERS.NET.</em><br /><em><em>A.ROOT-SERVERS.NET. 3600000 A 198.41.0.4</em></em><br /></em>The domain name "<strong>.</strong>" refers to the <strong>root zone</strong> and the value <strong>3600000</strong> is the explicit <strong>time to live</strong> (<strong>TTL</strong>) for the records in the file, but it is sometime ignored by DNS clients.<br /><br />The rest of the entries are self explanatory. If you want to grab a new copy of the root hint file you can ftp to ftp.rs.internic.net (198.41.0.6) and log on anonymously, there you will find the latest up to date version.</div>
<h2>The Named.conf File</h2>
<p style="text-align: justify;" align="left">The <strong>named.conf</strong> file is usually located in the /etc directory and is the key file that ties all the zone data files together and lets the DNS server know where they are located in the system. This file is automatically created during the installation but you must edit it in order to add new entries that will point to any new zone files you have created.</p>
<p style="text-align: justify;" align="left">Let's have a close look at the <strong>named.conf</strong> file and explain:</p>
<div class="box-content" style="text-align: justify;">options {<br /> directory "/var/named";<br /> <br /> };<br /><br />// Root Servers <br /> zone "." IN {<br /> type hint;<br /> file "named.ca";<br /> };<br /><br />// Entry for Firewall.cx - name to ip mapping<br /> zone "firewall.cx" IN {<br /> type master;<br /> file "db.firewall.cx";<br /> };<br /> <br /> // Entry for Firewall.cx - ip to name mapping<br /> zone "0.168.192.in-addr.arpa" IN {<br /> type master;<br /> file "db.192.168.0";<br /> }; <br /><br />// Entry for Local Loopback<br /> zone "0.0.127.in-addr.arpa" IN {<br /> type master;<br /> file "named.local";<br /> };</div>
<p style="text-align: justify;">At first glance it might seem a maze, but it's a lot simpler than you think. Break down each paragraph and you can see clearly the pattern that follows.</p>
<p style="text-align: justify;">Starting from the top, the options section simply defines the directory where all the files to follow are located, the rest are simply comments.</p>
<p style="text-align: justify;">The root servers section tells the DNS server where to find the root hints file, which contains all the root servers.</p>
<p style="text-align: justify;">Next up is the entry for our domain firewall.cx, we let the DNS server know which file contains all the zone entries for this domain and let it know that it will act as a master DNS server for the domain. The same applies for the entry to follow, which contains the IP to Name mappings, this is the <strong>0.168.192.in-addr.arpa</strong> zone.</p>
<p style="text-align: justify;">The last entry is required for the local loopback. We tell the DNS server which file contains the local loopback entries.</p>
<p style="text-align: justify;">Notice the "<strong>IN</strong>" class that is present in each section? If we accidentally forget to include it in our zone files, it wouldn't matter because the DNS server will automatically figure out the class from our <strong>named.conf</strong> file. It's imperative not to forget the "<strong>IN</strong>" (Internet) class in the <strong>named.conf</strong>, whereas it really doesnt matter if you don't put it in the zone files. It's good practice still to enter it in the zone files as we did, just to make sure you don't have any problems later on.</p>
<p style="text-align: justify;">And that ends our discussion for the <strong>common DNS (BIND) files</strong>.&nbsp; Next up is the configuration of our <a href="https://www.firewall.cx/operating-systems/linux-unix/linux-bind-slave-dns.html" title="Linux BIND Slave/Secondary DNS server">Linux BIND Slave/Secondary DNS server</a>.</p>
<p>&nbsp;</p>
<p>&nbsp;</p>]]></description>
			<category>Linux - Unix</category>
			<pubDate>Sun, 18 Dec 2011 08:00:00 +1100</pubDate>
		</item>
		<item>
			<title>Linux BIND DNS - Part 3: Configuring The db.192.168.0 Zone Data File</title>
			<link>https://www.firewall.cx/operating-systems/linux-unix/linux-bind-ipadd-data-file.html</link>
			<guid isPermaLink="true">https://www.firewall.cx/operating-systems/linux-unix/linux-bind-ipadd-data-file.html</guid>
			<description><![CDATA[<p style="text-align: justify;" align="left">The <strong>db.192.168.0 zone data file</strong> is the second file we need to <strong>create and configure</strong> for our <strong>BIND DNS server</strong>. As outlined in the <a href="https://www.firewall.cx/operating-systems/linux-unix/linux-bind-introduction.html" target="_blank" title="DNS-BIND Introduction">DNS-BIND Introduction</a>, this file's purpose is to provide the IP Address -to- name mappings. Note that this file is to be placed on the Master DNS server for our domain.</p>
<h2>Constructing The db.192.168.0 File</h2>
<p style="text-align: justify;" align="left">While we start to construct the file, you will notice many similarities with our previous file. Most resource records have already been covered and explained in our previous articles and therefore we will not repeat on this page.</p>
<p style="text-align: justify;" align="left">The first line is our $<strong>TTL </strong>control statement, followed by the <strong>Start Of Authority (SOA)</strong> resource record:</p>
<div class="box-content" style="text-align: justify;">$TTL 86400 <br /><br />0.168.192.in-addr.arpa. IN SOA voyager.firewall.cx. admin.firewall.cx. (<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 1 ; Serial<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; &nbsp; 3h ; Refresh after 3 hours<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 1h ; Retry after 1 hour<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 1w ; Expire after one week<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 1h ) ; Negative Caching TTL of 1 hour</div>
<div style="text-align: justify;">As you can see, everything above, except the first column of the first line, is identical to the db.firewall.cx file. The "<strong>0.168.192.in-addr.arpa</strong>" entry is our IP network in reverse order. The trick to figure out your own <em>in-addr.arpa</em> entry is to simply take your network address, reverse it, and add an "<strong>.in-addr.arpa.</strong>" at the end</div>
<p style="text-align: justify;"><strong>Name server</strong> resource records are next, follwed by the <strong>PTR</strong> resource record that creates our IP Address-to-name mappings. The syntax is nearly the same as <em>the db.domain</em> file, but keep in mind that we don't enter the full reversed IP Address for the name servers but only the first 3 octets which represent the network they belong to:</p>
<div class="box-content" style="text-align: justify;">; Name Servers defined here<br />0.168.192.in-addr.arpa. IN NS voyager.firewall.cx.<br />
<div>0.168.192.in-addr.arpa. IN NS gateway.firewall.cx.<br /><br />; IP Address to Name mappings<br /> 1.0.168.192.in-addr.arpa. IN PTR admin.firewall.cx.<br />5.0.168.192.in-addr.arpa. IN PTR enterprise.firewall.cx.<br />10.0.168.192.in-addr.arpa. IN PTR gateway.firewall.cx.<br />15.0.168.192.in-addr.arpa. IN PTR voyager.firewall.cx.<strong><em><br /></em></strong></div>
</div>
<p style="text-align: justify;">&nbsp;Time to look at the configuration file with all its entries:</p>
<div class="box-content" style="text-align: justify;">$TTL 86400 <br /><br />0.168.192.in-addr.arpa. IN SOA voyager.firewall.cx. admin.firewall.cx. (<br /><br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 1 ; Serial<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp; &nbsp; 3h ; Refresh after 3 hours<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 1h ; Retry after 1 hour<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 1w ; Expire after one week<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 1h ) ; Negative Caching TTL of 1 hour<br /><br />; Name Servers defined here<br />0.168.192.in-addr.arpa. IN NS voyager.firewall.cx.<br />0.168.192.in-addr.arpa. IN NS gateway.firewall.cx.<br /><br />; IP Address to Name mappings<br /> 1.0.168.192.in-addr.arpa. IN PTR admin.firewall.cx.<br />5.0.168.192.in-addr.arpa. IN PTR enterprise.firewall.cx.<br />10.0.168.192.in-addr.arpa. IN PTR gateway.firewall.cx.<br />15.0.168.192.in-addr.arpa. IN PTR voyager.firewall.cx.</div>
<p>This completes the confgiuration of our <strong>db.192.168.0 Zone data file</strong>. <br /><br />Remember the whole purpose of this file is to provide an <strong>IP Address-to-name mapping</strong>, which is why we do not use the domain name in front of each line, but the reversed IP Address followed by the<strong><em> in-addr.arpa.</em></strong> entry. Next article deals with the <a href="https://www.firewall.cx/operating-systems/linux-unix/linux-bind-common-files.html" title="Common Files in Linux BIND DNS">Common Files in Linux BIND DNS</a>.</p>]]></description>
			<category>Linux - Unix</category>
			<pubDate>Sat, 10 Dec 2011 10:40:16 +1100</pubDate>
		</item>
		<item>
			<title>Linux BIND DNS - Part 2: Configuring  db.domain Zone Data File</title>
			<link>https://www.firewall.cx/operating-systems/linux-unix/linux-bind-domain-zone-file.html</link>
			<guid isPermaLink="true">https://www.firewall.cx/operating-systems/linux-unix/linux-bind-domain-zone-file.html</guid>
			<description><![CDATA[<p style="text-align: justify;" align="left">It's time to start creating our zone files. We'll follow the standard format, which is given in the DNS RFCs, in order to keep everything neat and less confusing.</p>
<p style="text-align: justify;" align="left">First step is to decide on the domain we're using and we've decided on the popular firewall.cx. This means that the first zone file will be <strong>db.firewall.cx.</strong> Note that this file is to be placed on the Master DNS server for our domain.</p>
<p style="text-align: justify;" align="left">We will progressively build our database by populating it step by step and explaining each step we take. At the end of the step-by-step example, we'll grab each step's data and put it all together so we can see how the final version of our file will look. We strongly beleive, this is the best method of explaining how to create a zone file without confusing the hell out of everyone!</p>
<h2>Constructing db.firewall.cx - db.domain<span style="color: #cc99ff;"><br /></span></h2>
<p style="text-align: justify;">It is important at this point to make it clear that we are setting up a primary DNS server. For a simple DNS caching or secondary name server, the setup is a lot simpler and covered on the articles to come.</p>
<p style="text-align: justify;" align="left">The first entry for our file is the <strong>Default TTL</strong> - Time To Live. This is defined using the <strong>$TTL</strong> control statement. <strong>$TTL</strong> specifies the time to live for all records in the file that follow the statement and don't have an explicit TTL. We are going to set ours to 24 hours -&nbsp;86400 seconds.</p>
<p style="text-align: justify;">The units used are seconds. An older common TTL value for DNS was 86400 seconds, which is 24 hours. A TTL value of 86400 would mean that, if a DNS record was changed on the authoritative nameserver, DNS servers around the world could still be showing the old value from their cache for up to 24 hours after the change.</p>
<p style="text-align: justify;">Newer DNS methods that are part of a DR (Disaster Recovery) system may have some records deliberately set extremely low on TTL. For example a 300 second TTL would help key records expire in 5 minutes to help ensure these records are flushed world wide quickly. This gives administrators the ability to edit and update records in a timely manner. TTL values are "per record" and setting this value on specific records is normally honored automatically by all standard DNS systems world-wide.&nbsp;&nbsp; Dynamic DNS (DDNS) usually have the TTL value set to 5 minutes, or 300 seconds.</p>
<p style="text-align: justify;" align="left">Next up is the <strong>SOA Record</strong>. The SOA (Start Of Authority) resource record indicates that this name server is the best source of information for the data within this zone (this record is required in each db.DOMAIN and db.ADDR file), which is the same as saying this name server is Authoritative for this zone. There can be only one SOA record in every data zone file (db.DOMAIN).</p>
<div class="box-content" style="text-align: justify;" align="left">$TTL 86400 <br /><br />firewall.cx. IN SOA voyager.firewall.cx. admin.voyager.firewall.cx. (
<div align="left">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 1 ; Serial Number</div>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 3h ; Refresh after 3 hours<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 1h ; Retry after 1 hour<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 1w ; Expire after 1 week<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 1h ) ; Negative caching TTL of 1 hour</div>
<p style="text-align: justify;" align="left">Let's explain the above code:</p>
<p style="text-align: justify;" align="left"><strong>firewall.cx</strong>. is the domain name and must always be stated in the first column of our line, be sure you include the trailing dot "<strong>.</strong>" after the domain name, we'll explain later on why this is needed.</p>
<p style="text-align: justify;" align="left">The <strong>IN </strong>stands for Internet. This is one class of data and while other classes exist, you won't see them at all because they are not used :)</p>
<p style="text-align: justify;" align="left">The <strong>SOA </strong>is an important resource record. What follows is the actual primary name server for <strong>firewall.cx</strong>. In our example, this is the server named "<strong>voyager</strong>" and its Fully Qualified Domain Name (FQDN) is <strong>voyager.firewall.cx</strong>. Notice the trailing "<strong>.</strong>" is present here as well.</p>
<p style="text-align: justify;" align="left">Next up is the entry <strong>admin.voyager.firewall.cx.</strong> which is the email address of the person responsible for this domain. Take the dot "<strong>.</strong>" after the admin entry and replace it with a "<strong>@</strong>" and you have a valid email address: <strong>admin@voyager.firewall.cx.</strong> Most times you will see root, postmaster or hostmaster instead of "admin".</p>
<p style="text-align: justify;" align="left">The "<strong>(</strong>" parentheses allow the SOA record to span more than one line, while in most cases the fields that follow are used by the secondary name servers and any other name server requesting information about the domain.</p>
<p style="text-align: justify;" align="left">The serial number "<strong>1 ; Serial Number</strong>" entry is used by the secondary name server to keep track of changes that might have occured in the master's zone file. When the secondary name server contacts the primary name server, it will check to see if this value is the same. If the secondary's name server is lower than the primary's, then its data is out of date and, when equal, it means the data is up to date. This means when you make any modifications to the primary's zone file, you must increment the serial number at least by one.</p>
<p style="text-align: justify;" align="left">Note that anything after the semicolon (<strong>;</strong>) is considered a remark and not taken into consideration by the DNS BIND Service. This allows us to create easy-to-understand comments for future reference.</p>
<p style="text-align: justify;" align="left">The refresh "<strong>3h ; Refresh after 3 hours</strong>" tells the secondary name server how often to check the primary's server's data, to ensure its copy for this zone is up to date.</p>
<p style="text-align: justify;" align="left">If the secondary name server tries to contact the primary and fails, the retry "<strong>1 h ; Retry after 1 hour</strong>" is used to tell the secondary name server how long to wait until it tries to contact the primary again.</p>
<p style="text-align: justify;" align="left">If the secondary name server fails to contact the primary for longer than the time specified in the fourth entry "<strong>1 w ; Expire after 1 week</strong>", then the zone data on the secondary name server is considered too old and will expire.</p>
<p style="text-align: justify;" align="left">The last line "<strong>1 h ) ; Negative caching TTL of 1 day</strong>" is how long a name server will send negative responses about the zone. These negative responses say that a particular domain or type of data sought for a particular domain name doesn't exist. Notice the SOA section finishes with the "<strong>)</strong>" parentheses.</p>
<p style="text-align: justify;" align="left">Next up in the file are the name server (NS) records:</p>
<div class="box-content" style="text-align: justify;" align="left">
<p>; Name Servers defined here</p>
<p align="left">firewall.cx. IN NS voyager.firewall.cx.</p>
<p>firewall.cx. IN NS gateway.firewall.cx.</p>
</div>
<p style="text-align: justify;" align="left">These entries define the two name servers (voyager and gateway) for our domain firewall.cx. These entries will be also in the db.ADDR file for this domain as we will see later on.</p>
<p style="text-align: justify;" align="left">It's time to enter our MX records. These records define the mail exchange servers for our domain, and this is how any client, host or email server is able to find a domain's email server:</p>
<div class="box-content" style="text-align: justify;" align="left">; Mail Exchange servers defined here<br />
<p align="left">firewall.cx. IN MX 10 voyager.firewall.cx.</p>
<p align="left">firewall.cx. IN MX 20 gateway.firewall.cx.</p>
</div>
<p style="text-align: justify;" align="left">Let's explain what exactly these entries mean. The first line specifies that voyager.firewall.cx is a mail exchanger for firewall.cx, just as the second line (...<strong>IN MX 20 gateway</strong>...) specifies that gateway.firewall.cx is also a mail exchanger for the domain. The <strong>MX</strong> record indicates that the following hosts are mail exchanger servers for the domain and the numbers 10 and 20 indicate the priority level. The smaller the number, the higher the priority.</p>
<p style="text-align: justify;" align="left">This means that voyager.firewall.cx is a higher priority mail server than gateway.firewall.cx.&nbsp; If another server trying to send email to firewall.cx fails to contact the highest priority mail server (voyager.firewall.cx), it will then fall back to the secondary, in which our case is gateway.firewall.cx.</p>
<p style="text-align: justify;" align="left">These entries were introduced to prevent mail loops. When another email server (unlikely for a private domain like mine, but the same rule applies for the Internet) wants to send mail to firewall.cx, it will try to contact first the mail exchanger with the smallest number, which in our case is voyager.firewall.cx. The smaller the number, the higher the priority if there are more than one mail servers.</p>
<p style="text-align: justify;" align="left">In our example, if we replaced:</p>
<p style="text-align: justify;" align="left"><strong>firewall.cx. IN MX 10 voyager.firewall.cx.</strong></p>
<p style="text-align: justify;" align="left"><strong>firewall.cx. IN MX 20 gateway.firewall.cx.</strong></p>
<p style="text-align: justify;" align="left">with</p>
<p style="text-align: justify;" align="left"><strong>firewall.cx. IN MX 50 voyager.firewall.cx.</strong></p>
<p style="text-align: justify;" align="left"><strong>firewall.cx. IN MX 100 gateway.firewall.cx.</strong></p>
<p style="text-align: justify;" align="left">the result in matter of server priority, would be the same.</p>
<p style="text-align: justify;" align="left">Let's now have a look our next part of our zone file: <strong>Host IP Addresses</strong> and <strong>Alias records</strong>:</p>
<div class="box-content" style="text-align: justify;" align="left">; Host addresses defined here<br />
<p align="left">localhost.firewall.cx. IN A 127.0.0.1</p>
<p align="left">voyager.firewall.cx. IN A 192.168.0.15</p>
<p align="left">enterprise.firewall.cx. IN A 192.168.0.5</p>
<p align="left">gateway.firewall.cx. IN A 192.168.0.10</p>
<p align="left">admin.firewall.cx. IN A 192.168.0.1</p>
<p align="left">; Aliases</p>
<p align="left">www.firewall.cx. IN CNAME voyager.firewall.cx.</p>
</div>
<p style="text-align: justify;" align="left">Most fields in this section are easy to understand. We start by defining our localhost (local loopback) "<strong>localhost.firewall.cx. IN A 127.0.0.1</strong>" and continue with the servers on our private network, these include voyager, enterprise, gateway and admin. The "<strong>A</strong>" record stands for IP Address. So "<strong>voyager.firewall.cx. IN A 192.168.0.15</strong>" translates to a host called <strong>voyager </strong>located in the <strong>firewall.cx</strong> domain with an <strong>IN</strong>ternet ip Address of <strong>192.168.0.15</strong>. See the pattern? :)</p>
<p style="text-align: justify;" align="left">The second block has the aliases table, where we created a Canonical Name (<strong>CNAME</strong>) record. A <strong>CNAME </strong>record simply maps an alias to its canonical name; in our example, www is the alias and voyager.firewall.cx is the canonical name.</p>
<p style="text-align: justify;" align="left">When a name server looks up a name and finds <strong>CNAME </strong>records, it replaces the name (alias - www) with its canonical name (voyager.firewall.cx) and looks up the canonical name (voyager.firewall.cx).</p>
<p style="text-align: justify;" align="left">For example, when a name server looks up www.firewall.cx, it will replace the '<strong>www</strong>' with '<strong>voyager</strong>' and lookup the IP Address for <strong>voyager.firewall.cx</strong>.</p>
<p style="text-align: justify;" align="left">This also explains the existance of "<strong>www</strong>" in all URLs - it's nothing more than an <strong>alias </strong>which, ultimately, is replaced with the <strong>CNAME </strong>record defined.</p>
<h2 style="text-align: justify;" align="left">The Complete db.domain Configuration File</h2>
<p style="text-align: justify;" align="left">That completes a simple domain setup! We have now created a working zone file that looks like this:</p>
<div class="box-content" style="text-align: justify;" align="left">$TTL 86400 <br /><br />firewall.cx. IN SOA voyager.firewall.cx. admin.voyager.firewall.cx. (
<div align="left">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 1 ; Serial Number</div>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 3h ; Refresh after 3 hours<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 1h ; Retry after 1 hour<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 1w ; Expire after 1 week<br />&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 1h ) ; Negative caching TTL of 1 hour<br />
<p align="left">; Name Servers defined here</p>
<p align="left">firewall.cx. IN NS voyager.firewall.cx.</p>
<p align="left">firewall.cx. IN NS gateway.firewall.cx.</p>
<p align="left">; Mail Exchange servers defined here</p>
<p align="left">firewall.cx. IN MX 10 voyager.firewall.cx.</p>
<p align="left">firewall.cx. IN MX 20 gateway.firewall.cx.</p>
<p align="left">; Host Addresses Defined Here</p>
<p align="left">localhost.firewall.cx. IN A 127.0.0.1</p>
<p align="left">voyager.firewall.cx. IN A 192.168.0.15</p>
<p align="left">enterprise.firewall.cx. IN A 192.168.0.5</p>
<p align="left">gateway.firewall.cx. IN A 192.168.0.10</p>
<p align="left">admin.firewall.cx. IN A 192.168.0.1</p>
<p align="left">; Aliases</p>
<p align="left">www.firewall.cx. IN CNAME voyager.firewall.cx.</p>
</div>
<p style="text-align: justify;" align="left">A quick glance at this file tells you a lot about our lab domain firewall.cx, and this is probably the best time to explain why we should <span style="text-decoration: underline;">not omit</span> the trailing dot at the end of the domain name:</p>
<p style="text-align: justify;" align="left">If we took <strong>gateway.firewall.cx</strong> as an example and omitted the dot "<strong>.</strong>" at the end of our entries, the system would translate it like this: <strong>gateway.firewall.cx.firewall.cx</strong> - definately not&nbsp; what we want!</p>
<p style="text-align: justify;" align="left">As you see, the '<strong>firewall.cx</strong>' is appended to the end of our <strong>Fully Qualified Domain Name</strong> for the particular resource record (<strong>gateway</strong>). This is why it's so important to never forget that extra dot "<strong>.</strong>" at the end!</p>
<p style="text-align: justify;" align="left">Our next article will cover the <strong>db.ADDR</strong> file, which will take the name <strong>db.192.168.0.</strong> for our example.<strong><br /></strong></p>]]></description>
			<category>Linux - Unix</category>
			<pubDate>Sat, 10 Dec 2011 10:38:14 +1100</pubDate>
		</item>
		<item>
			<title>Linux BIND DNS - Part 1: Introduction To The DNS Database (BIND) </title>
			<link>https://www.firewall.cx/operating-systems/linux-unix/linux-bind-introduction.html</link>
			<guid isPermaLink="true">https://www.firewall.cx/operating-systems/linux-unix/linux-bind-introduction.html</guid>
			<description><![CDATA[<p style="text-align: justify;" align="left"><strong>BIND</strong> (Berkely Internet Name Domain) is a popular software for translating domain names into IP addresses and usually found on Linux servers. This article will explain the basic concepts of DNS BIND and analyse the associated files required to successfully setup your own DNS BIND server. After reading this article, you will be able to successfully install and setup a Linux BIND DNS server for your network.</p>
<h2>Zones and Domains</h2>
<p style="text-align: justify;" align="left">The programs that store information about the domain name space are called name servers, as you probably already know. Name Servers generally have complete information about some part of the domain name space (a zone), which they load from a file. The name server is then said to have authority for that zone.</p>
<p>The term <strong>zone</strong> is not one that you come across every day while you're surfing on the Internet. We tend to think that the&nbsp;<strong>domain</strong> concept is all there is when it comes to DNS, which makes life easy for us, but when dealing with DNS servers that hold data for our domains (name servers), then we need to introduce the <em>zone</em> term since it is essential so we can understand the setup of a DNS server.</p>
<p>The difference between a <strong>zone</strong> and a <strong>domain</strong> is important, but subtle. The best way to understand the difference is by using a good example, which is coming up next.</p>
<p style="text-align: justify;" align="left">The COM domain is divided into many zones, including the hp.com zone, sun.com, it.com. At the top of the domain, there is also a com zone.</p>
<p style="text-align: justify;" align="left">The diagram below shows you how a zone fits within a domain:</p>
<p align="left">&nbsp;<img src="https://www.firewall.cx/images/stories/dns-bind-intro-1.gif" alt="dns-bind-intro-1" width="401" height="414" style="display: block; margin-left: auto; margin-right: auto;" /></p>
<p style="text-align: justify;" align="left">&nbsp;</p>
<p>The trick to understanding how it works is to remember that a zone exists "inside" a domain. Name servers load zone files, not domains. <strong>Zone files</strong> contain information about the portion of a domain for which they are responsible. This could be the whole domain (<strong>sun.com</strong>, <strong>it.com</strong>) or simply a portion of it (<strong>hp.com</strong> + <strong>pr.hp.com</strong>).</p>
<p style="text-align: justify;" align="left">In our example, the hp.com domain has two subdomains, support.hp.com and pr.hp.com. The first one, support.hp.com is controlled by its own name servers as it has its own <em>zone</em>, called the support.hp.com zone. The second one though, pr.hp.com is controlled by the same name server that takes care of the hp.com zone.</p>
<p style="text-align: justify;" align="left">The hp.com zone has very little information about the support.hp.com zone, it simply knows its right below. If anyone requires more information on support.hp.com, it will be requested to contact the authoritative name servsers for that subdomain, which are the name servers for that zone.</p>
<p style="text-align: justify;" align="left">So you see that even though support.hp.com is a subdomain just like pr.hp.com, it is not setup and controlled the same way as pr.hp.com.</p>
<p style="text-align: justify;" align="left">On the other hand, the Sun.com domain has one zone (sun.com zone) that contains and controlls the whole domain. This zone is loaded by the authoritative name servers.</p>
<h2>BIND? Never Heard of it!</h2>
<p style="text-align: justify;" align="left">As mentioned in the beginning of this article, BIND stands for Berkely Internet Name Domain. Keeping things simple, it's a program you download (<a href="http://www.bind.org/" target="_blank" rel="nofollow noopener">www.bind.org</a>) and install on your Unix or Linux server to give it the ability to become a DNS server for your private (lan) or public (Internet) network.</p>
<p style="text-align: justify;" align="left">The majority of DNS servers are based on BIND as it's a proven and reliable DNS server. The download is approximately 4.8 MBytes. Untarring and compiling BIND is a pretty straight forward process and the steps required will depend on your Linux distribution and version. If you follow the instructions provided with the download, you shouldn't have any problems.&nbsp; For simplicity purposes, we assume you've compiled and installed the BIND program using the provided instructions.</p>
<h2 style="text-align: justify;" align="left">Setting Up Your Zone Data</h2>
<p style="text-align: justify;" align="left">No matter what Linux distribution you have, the file structure is pretty much the same. I have BIND installed on my Linux server, which runs Slackware v8 with kernel 2.4.19. By following the installation procedure found in the documentation provided with BIND, you will have the server installed within 15 min at most.</p>
<p style="text-align: justify;" align="left">Once the installation of BIND is complete you need to start creating your zone data files. Remember, these are the files the DNS server will load in order to understand how your domain is setup and the various hosts within it.</p>
<p style="text-align: justify;" align="left">A DNS server has multiple files that contain information about the domain setup. From these files, one will map all host names to IP Addresses and other files will map the IP Address back to hostnames. The name-to-IP Address lookup is sometimes called <em>forward mapping</em> and the IP Address-to-name lookup <em>reverse mapping</em>. Each network will have its own file for reverse-mapping.</p>
<p style="text-align: justify;" align="left">As a convention in this section, a file that maps hostnames to IP Addresses will be called <em>db.DOMAIN</em>, where <em>DOMAIN</em> is the name of your domain e.g. db.firewall.cx, and <em>db</em> is short for DataBase.The files mapping IP Address to hostnames are called db.<em>ADDR </em>where <em>ADDR</em> is the network number without trailing zeros or the specification of a netmask, e.g db.192.168.0 for the 192.168.0.0 network.</p>
<p style="text-align: justify;" align="left">The collection of our <strong>db.DOMAIN</strong> and <strong>db.ADDR</strong> files are our Zone Data files. There are a few other zone data files, some of which are created during the installation of BIND: <strong>named.ca</strong>,<strong> localhost.zone</strong> and<strong> named.local</strong>.</p>
<p style="text-align: justify;" align="left">Named.ca contains information about the root servers on the Internet, should your DNS server require to contact one of them. Localhost.zone and Named.local are there to cover the loopback network. The loopback address is a special address hosts use to direct traffic to themselves. This is usually IP Address 127.0.0.1, which belongs to the 127.0.0.0/24 network.</p>
<p style="text-align: justify;" align="left">These files must be present in each DNS server and are the same for every DNS server.</p>
<h2>Quick Summary of Our Files</h2>
<p style="text-align: justify;" align="left">Let's have a quick look at the files we have covered so far to make sure we don't lose track:</p>
<p style="text-align: justify;" align="left">1) Following files must be created by you and will contain the data for our zone:</p>
<ul style="text-align: justify;">
<li><strong>db.DOMAIN</strong> e.g db.space.net - Host to IP Address mapping</li>
<li><strong>db.ADDR</strong> e.g db.192.168.0 - IP Address to Host mapping</li>
</ul>
<p style="text-align: justify;">2) Following files are usually created by the BIND installation:</p>
<ul style="text-align: justify;">
<li><strong>named.ca</strong> - Contains the ROOT DNS servers</li>
<li><strong>named.local</strong> &amp; <strong>localhost.zone</strong> - Special files so the server can direct traffic to itself.</li>
</ul>
<p style="text-align: justify;">You should also be aware that the file names can change, there is no standard for names, it's just very convenient and tidy to keep some type of convention.</p>
<p style="text-align: justify;">To tie all the zone data files together a name server needs a configuration file. BIND version 8 and above calls it named.conf and it can be found in your /etc dir once you install the BIND package. Named.conf simply tells the name server where your zone files are located and we will be analysing this file later on.</p>
<p style="text-align: justify;">Most entries in the zone data files are called DNS resource records. Since DNS lookups are case insensitive, you can enter names in your zone data files in uppercase, lowercase or mixed case. I tend to use lowercase.</p>
<p style="text-align: justify;">Resource records must start in the first column of a line. The DNS RFCs have samples that present the order in which one should enter the resource records. Some people choose to follow this order, while others don't. You are not required to follow this order, but I do :)</p>
<p style="text-align: justify;">Here is the order of resource records in the zone data file:</p>
<p><strong>SOA record</strong> - Indicates authority for this zone.</p>
<p><strong>NS record</strong> - Lists a name server for this zone</p>
<p><strong>MX record</strong> - Indicates the mail exchange server for the domain</p>
<p><strong>A record</strong> - Name to IP Address mapping (gives the IP Address for a host)</p>
<p><strong>CNAME record</strong> - Canonical name (used for aliases)</p>
<p><strong>PTR record</strong> - Address to name mapping (used in db.ADDR)</p>
<p style="text-align: justify;">The next article (Part 2) deals with the construction of our first zone data file, <strong>db.firewall.cx</strong> of our example <strong>firewall.cx</strong> domain.</p>
<p>&nbsp;</p>
<p></p>
<p>&nbsp;</p>]]></description>
			<category>Linux - Unix</category>
			<pubDate>Sat, 10 Dec 2011 10:32:22 +1100</pubDate>
		</item>
		<item>
			<title>Finding More Information On The Linux Operating System</title>
			<link>https://www.firewall.cx/operating-systems/linux-unix/linux-more-info.html</link>
			<guid isPermaLink="true">https://www.firewall.cx/operating-systems/linux-unix/linux-more-info.html</guid>
			<description><![CDATA[<p>Since this document merely scratches the surface when it comes to Linux, you will probably find you have lots of questions and possibly problems. Whether these are problems with the operating system, or not knowing the proper way to perform the task in Linux, there is always a place to find help.</p>
<p style="text-align: justify;">On our forums you'll find a lot of experienced people always willing to go that extra mile to help you out, so don't hesitate to ask - you'll be suprised at the responses!</p>
<p style="text-align: justify;">Generally the Linux community is a very helpful one. You'll be happy to know that there is more documentation, tutorials, HOW-TOs and FAQs (Frequently Asked Questions) for Linux than for all other operating systems in the world!</p>
<p style="text-align: justify;">If you go to any search engine, forum or news group researching a problem, you'll always find an answer.</p>
<p style="text-align: justify;">To save you some searching, here are a few websites where you can find information covering most aspects of the operating system:</p>
<ul style="text-align: justify;">
<li><a href="https://tldp.org/" target="_blank" rel="nofollow noopener">https://tldp.org/</a>&nbsp;- The Linux Documentation Project homepage has the largest collection of tutorials, HOW-TOs and FAQs for Linux.</li>
</ul>
<ul style="text-align: justify;">
<li><a href="https://www.linux.org/" target="_blank" rel="nofollow noopener">https://www.linux.org/</a>- The documentation page from the official Linux.org website. Contains links to a lot of useful information.</li>
</ul>
<ul style="text-align: justify;">
<li><a href="https://docs.fedoraproject.org/en-US/quick-docs/fedora-and-red-hat-enterprise-linux/">https://docs.fedoraproject.org/en-US/quick-docs/fedora-and-red-hat-enterprise-linux/</a>&nbsp;- The Red Hat Fedora Linux manuals page. Almost all of this information will apply to any other version of Linux as well. All the guides here are full of very useful information. You can download all the guides to view offline.</li>
</ul>
<ul style="text-align: justify;">
<li><a href="https://forums.justlinux.com/" target="_blank" rel="nofollow noopener">https://forums.justlinux.com/</a>&nbsp;- Contains a library of information for beginners on all topics from setting up hardware, installing software, to compiling the kernel</li>
</ul>
<ul style="text-align: justify;">
<li><a href="https://www.linuxquestions.org/" target="_blank" rel="nofollow noopener">https://www.linuxquestions.org/</a>- The second best place (we're the first :&gt; ) to post a question if you have a problem.</li>
</ul>
<ul style="text-align: justify;">
<li><a href="https://rpm.pbone.net/" target="_blank" rel="nofollow noopener">https://rpm.pbone.net/</a>&nbsp;- Pbone is a great search engine to find RPM packages for your Linux operating system.</li>
</ul>
<ul style="text-align: justify;">
<li><a href="https://sourceforge.net/" target="_blank" rel="nofollow noopener">https://sourceforge.net/</a>&nbsp;- The world's largest development and download repository of Open Source code (free) and applications. Sourceforge hosts thousands of open source projects, most of which are of course for the Linux operating system.</li>
</ul>
<p style="text-align: justify;">We hope you have enjoyed this brief introduction to the Linux operating system and hope you'll be tempted to try Linux for yourself. You've surely got nothing to lose and everything to gain!</p>
<p style="text-align: justify;">Remember, Linux is the No.1 operating system when it comes to web services and mission critical servers - it's not a coincidence other major software vendors are doing everything they can to stop Linux from gaining more ground!</p>
<p>Visit our <a href="https://www.firewall.cx/operating-systems/linux-unix.html" title="Linux section">Linux section</a> to discover more engaging technical articles on the <strong>Linux Operating system</strong>.</p>]]></description>
			<category>Linux - Unix</category>
			<pubDate>Thu, 21 Jul 2011 07:15:07 +1000</pubDate>
		</item>
		<item>
			<title>Linux File &amp; Folder Permissions</title>
			<link>https://www.firewall.cx/operating-systems/linux-unix/linux-file-folder-permissions.html</link>
			<guid isPermaLink="true">https://www.firewall.cx/operating-systems/linux-unix/linux-file-folder-permissions.html</guid>
			<description><![CDATA[<p style="text-align: justify;"><strong>File &amp; folder security</strong> is a big part of any operating system and Linux is no exception!</p>
<p style="text-align: justify;">These permissions allow you to choose exactly who can access your files and folders, providing an overall enhanced security system. This is one of the major weaknesses in the older Windows operating systems where, by default, all users can see each other's files (Windows 95, 98, Me).</p>
<p style="text-align: justify;">For the more superior versions of the Windows operating system such as NT, 2000, XP and 2003 things look a lot safer as they fully support file &amp; folder permissions, just as Linux has since the beginning.</p>
<p style="text-align: justify;">Together, we'll now examine a directory listing from our Linux lab server, to help us understand the information provided. While a simple 'ls' will give you the file and directory listing within a given directory, adding the flag '-l' will reveal a number of new fields that we are about to take a look at:</p>
<p align="center"><img src="https://www.firewall.cx/images/stories/linux-introduction-file-permissions-1.gif" alt="linux-introduction-file-permissions-1" width="578" height="284" style="display: block; margin-left: auto; margin-right: auto;" /></p>
<p style="text-align: justify;">It's possible that most Linux users have seen similar information regarding their files and folders and therefore should feel pretty comfortable with it. If on the other hand you happen to fall in to the group of people who haven't seen such information before, then you either work too much in the GUI interface of Linux, or simply haven't had much experience with the operating system :)</p>
<p style="text-align: justify;">Whatever the case, don't disappear - it's easier than you think!!</p>
<h2>Understanding "drwx"</h2>
<p style="text-align: justify;">Let's start from scratch, analysing the information in the previous screenshot.</p>
<p align="center"><img src="https://www.firewall.cx/images/stories/linux-introduction-file-permissions-2.gif" alt="linux-introduction-file-permissions-2" width="578" height="284" style="display: block; margin-left: auto; margin-right: auto;" /></p>
<p style="text-align: justify;">In the <strong>yellow</strong> column on the right we have the file &amp; directory names (dirlist.txt, document1, document2 etc.) - nothing new here. Next, in the <strong>green</strong> column, we will find the time and date of creation.</p>
<p style="text-align: justify;">Note that the date and time column will not always display in the format shown. If the file or directory it refers to was created in a year different from the current one, it will then show only the date, month and year, discarding the time of creation.</p>
<p style="text-align: justify;">For example, if the file 'dirlist.txt' was created on the 27th of July, 2004, then the system would show:</p>
<p><em>Jun 27 2004 dirlist.txt</em></p>
<p style="text-align: justify;">instead of</p>
<p><em>Jun 27 11:28 dirlist.txt</em></p>
<p style="text-align: justify;">A small but important note when examining files and folders! Lastly, the date will change when modifying the file. As such, if we edited a file created last year, then the next time we typed 'ls -l', the file's date information would change to today's date. This is a way you can check to see if files have been modified or tampered with.</p>
<p style="text-align: justify;">The next column (purple) contains the file size in bytes - again nothing special here.</p>
<p align="center"><img src="https://www.firewall.cx/images/stories/linux-introduction-file-permissions-3.gif" alt="linux-introduction-file-permissions-3" width="578" height="284" style="display: block; margin-left: auto; margin-right: auto;" /></p>
<p style="text-align: justify;">Next column (orange) shows the permissions. Every file in Linux is 'owned' by a particular user.. normally this is the user (owner) who created the file.. but you can always give ownership to someone else.</p>
<p style="text-align: justify;">The owner might belong to a particular group, in which case this file is also associated with the user's group. In our example, the left column labeled 'User' refers to the actual user that owns the file, while the right column labeled 'group' refers to the group the file belongs to.</p>
<p style="text-align: justify;">Looking at the file named 'dirlist.txt', we can now understand that it belongs to the user named 'root' and group named 'sys'.</p>
<p style="text-align: justify;">Following the permissions is the column with the <strong>cyan</strong> border in the listing.</p>
<p style="text-align: justify;">The system identifies files by their inode number, which is the unique file system identifier for the file. A directory is actually a listing of inode numbers with their corresponding filenames. Each filename in a directory is a link to a particular inode.</p>
<p style="text-align: justify;">Links let you give a single file more than one name. Therefore, the numbers indicated in the <strong>cyan</strong> column specifies the number of links to the file.</p>
<p style="text-align: justify;">As it turns out, a directory is actually just a file containing information about link-to-inode associations.</p>
<p style="text-align: justify;">Next up is a very important column, that's the first one on the left containing the '-rwx----w-' characters. These are the actual permissions set for the particular file or directory we are examining.</p>
<p style="text-align: justify;">To make things easier, we've split the permissions section into a further 4 columns as shown above. The first column indicates whether we are talking about a directory (d), file (-) or link (l).</p>
<p style="text-align: justify;">In the newer Linux distributions, the system will usually present the directory name in colour, helping it to stand out from the rest of the files. In the case of a file, a dash (-) or the letter 'f' is used, while links make the use of the letter 'l' (l). For those unfamiliar with links, consider them something similar to the Windows shortcuts.</p>
<p align="center"><img src="https://www.firewall.cx/images/stories/linux-introduction-file-permissions-4.gif" alt="linux-introduction-file-permissions-4" width="578" height="217" style="display: block; margin-left: auto; margin-right: auto;" /></p>
<p style="text-align: justify;">Column 2 refers to the user rights. This is the owner of the file, directory or link and these three characters determine what the owner can do with it.</p>
<p style="text-align: justify;">The 3 characters on column 2 are the permissions for the <strong>owner </strong>(user rights) of the file or directory. The next 3 are permissions for the <strong>group</strong> that the file is owned by and the final 3 characters define the access permissions for the <strong>others group</strong>, that is, everyone else not part of the group.</p>
<p style="text-align: justify;">So, there are 3 possible attributes that make up file access permissions:</p>
<ul class="check">
<li><strong>r - Read permission</strong>. Whether the file may be read. In the case of a directory, this would mean the ability to list the contents of the directory.</li>
<li><strong>w - Write permission</strong>. Whether the file may be written to or modified. For a directory, this defines whether you can make any changes to the contents of the directory. If write permission is not set then you will not be able to delete, rename or create a file.</li>
<li><strong>x - Execute permission</strong>. Whether the file may be executed. In the case of a directory, this attribute decides whether you have permission to enter, run a search through that directory or execute some program from that directory.</li>
</ul>
<p style="text-align: justify;">Let's take a look at another example:</p>
<p align="center"><img src="https://www.firewall.cx/images/stories/linux-introduction-file-permissions-5.gif" alt="linux-introduction-file-permissions-5" width="578" height="284" style="display: block; margin-left: auto; margin-right: auto;" /></p>
<p style="text-align: justify;">Take the permissions of 'red-bulb', which are <strong>drwxr-x---</strong>. The owner of this directory is user david and the <strong>group owner</strong> of the directory is sys. The <strong>first 3 permission</strong> attributes are <strong>rwx</strong>. These permissions allow full read, write and execute access to the directory to user david. So we conclude that david has full access here.</p>
<p style="text-align: justify;">The <strong>group permissions</strong> are <strong>r-x</strong>. Notice there is no write permission given here so while members of the group <strong>sys</strong> can look at the directory and list its contents, they cannot create new files or sub-directories. They also cannot delete any files or make changes to the directory content in any way.</p>
<p style="text-align: justify;">Lastly, no one else has any access because the access attributes for <strong>others</strong> are <strong>- - -</strong>.</p>
<p style="text-align: justify;">If we assume the permissions are <strong>drw-r--r--</strong> you see that the <strong>owner</strong> of the directory (david) can list and make changes to its contents (<strong>Read</strong> and <strong>Write</strong> access) but, because there is no <strong>execute </strong>(<strong>x</strong>) permission, the user is unable to enter it! You <span style="font-weight: bold;">must</span> have <strong>read</strong> and <strong>execute</strong> (<strong>r-x</strong>) in order to enter a directory and list its contents. Members of the <strong>group sys</strong> have a similar problem, where they seem to be able to <strong>read </strong>(<strong>list</strong>) the directory's contents but can't enter it because there is no <strong>execute </strong>(<strong>x</strong>) permission given!</p>
<p style="text-align: justify;">Lastly, <strong>everyone else</strong> can also <strong>read </strong>(<strong>list</strong>) the directory but is unable to enter it because of the absence of the <strong>execute </strong>(<strong>x</strong>) permission.</p>
<p style="text-align: justify;">Here are some more examples focusing on the permissions:</p>
<p><strong>-r--r--r-- </strong>:This means that <strong>owner</strong>, <strong>group</strong> and <strong>everyone else</strong> has only read permissions to the file (remember, if there's no '<strong>d</strong>' or '<strong>l</strong>', then we are talking<span> about a file).</span></p>
<p><strong>-rw-rw-rw-</strong> : This means that the <strong>owner</strong>, <strong>group </strong>and <strong>everyone else</strong> has read and write permissions.</p>
<p><strong>-rwxrwxrwx </strong>: Here, the <strong>owner</strong>, <strong>group </strong>and <strong>everyone else</strong> has full permissions, so they can all read, write and execute the file (<span style="color: #ff0033;">-</span>).</p>
<h2>Modifying Ownership &amp; Permissions</h2>
<p style="text-align: justify;">So how do you change permissions or change the owner of a file?</p>
<p style="text-align: justify;">Changing the owner or group owner of a file is very simple, you just type '<strong><em>chown user:group filename.ext</em></strong>', where 'user' and 'group' are those to whom you want to give ownership of the file. The 'group' parameter is optional, so if you type '<em><strong>chown david file.txt</strong></em>', you will give ownership of file.txt to the user named david.</p>
<p style="text-align: justify;">In the case of a directory, nothing much changes as the same command is used. However, because directories usually contain files that also need to be assigned to the new user or group, we use the '<strong>-R</strong>' flag, which stands for 'recursive' - in other words all subdirectories and their files: '<strong><em>chown -R user:group dirname</em></strong>'.</p>
<p style="text-align: justify;">To change permissions you use the 'chmod' command. The possible options here are '<strong>u</strong>' for the <strong>user</strong>, '<strong>g</strong>' for the <strong>group</strong>, '<strong>o</strong>' for <strong>other</strong>, and '<strong>a</strong>' for <strong>all three</strong>. If you don't specify one of these letters it will change to all by default. After this you specify the permissions to add or remove using '<strong>+</strong>' or '<strong>-</strong>' . Let's take a look at an example to make it easier to understand:</p>
<p style="text-align: justify;">If we wanted to add read, write and execute to the user of a particular file, we would type the following '<em><strong>chmod u+rwx file.txt</strong></em>'. If on the other hand you typed '<strong><em>chmod g-rw file.txt</em></strong>' you will take away read and write permissions of that file for the group .</p>
<p style="text-align: justify;">While it's not terribly difficult to modify the permissions of a file or directory, remembering all the flags can be hard. Thankfully there's another way, which is less complicated and much faster. By replacing the permissions with numbers, we are able to calculate the required permissions and simply enter the correct sum of various numbers instead of the actual rights.</p>
<p style="text-align: justify;">The way this works is simple. We are aware of three different permissions, <strong>Read </strong>(<strong>r</strong>), <strong>Write</strong> (<strong>w</strong>) and <strong>Execute</strong> (<strong>x</strong>). Each of these permissions is assigned a number as follows:</p>
<p style="text-align: left;" align="center"><strong>r (read) - 4</strong></p>
<p style="text-align: left;" align="center"><strong>w (write) - 2</strong></p>
<p style="text-align: left;" align="center"><strong>x (execute) - 1</strong></p>
<p style="text-align: justify;">Now, to correctly assign a permission, all you need to do is add up the level you want, so if you want someone to have read and write, you get 4+2=6, if you want someone to have just execute, it's just 1.. zero means no permissions. You work out the number for each of the three sections (<strong>owner</strong>, <strong>group </strong>and <strong>everyone </strong>else).</p>
<p style="text-align: justify;">If you want to give read write and execute to the owner and nothing to everyone else, you'd get the number <strong>7 0 0</strong>. Starting from the left, the first digit (<strong>7</strong>) presents the permissions for the <strong>owner </strong>of the file, the second digit (<strong>0</strong>) is the permissions for the <strong>group</strong>, and the last (<strong>0</strong>) is the permissions for <strong>everyone </strong>else. You get the 7 by adding read, write and execute permissions according to the numbers assigned to each right as shown in the previous paragraphs: 4+2+1 = 7.</p>
<table border="1" style="width: 435px;" cellspacing="1" cellpadding="1" align="center">
<tbody>
<tr>
<td style="width: 31%;">
<div align="center"><strong>r, w, x Permissions</strong></div>
</td>
<td style="width: 33%;">
<div align="center"><strong>Calculated Number</strong></div>
</td>
</tr>
<tr>
<td style="width: 31%;">
<p style="font-size: x-small;" align="center"><span style="font-size: 12pt;">---</span></p>
</td>
<td style="width: 33%;">
<div style="font-size: x-small;" align="center"><span style="font-size: 12pt;">0</span></div>
</td>
</tr>
<tr>
<td style="width: 31%;">
<div style="font-size: x-small;" align="center"><span style="font-size: 12pt;">--x</span></div>
</td>
<td style="width: 33%;">
<div style="font-size: x-small;" align="center"><span style="font-size: 12pt;">1</span></div>
</td>
</tr>
<tr>
<td style="width: 31%;">
<div style="font-size: x-small;" align="center"><span style="font-size: 12pt;">-w-</span></div>
</td>
<td style="width: 33%;">
<div style="font-size: x-small;" align="center"><span style="font-size: 12pt;">2</span></div>
</td>
</tr>
<tr>
<td style="width: 31%;">
<div style="font-size: x-small;" align="center"><span style="font-size: 12pt;">-wx</span></div>
</td>
<td style="width: 33%;">
<div style="font-size: x-small;" align="center"><span style="font-size: 12pt;">3 (2+1)</span></div>
</td>
</tr>
<tr>
<td style="width: 31%;">
<div style="font-size: x-small;" align="center"><span style="font-size: 12pt;">r--</span></div>
</td>
<td style="width: 33%;">
<div style="font-size: x-small;" align="center"><span style="font-size: 12pt;">4</span></div>
</td>
</tr>
<tr>
<td style="width: 31%;">
<div style="font-size: x-small;" align="center"><span style="font-size: 12pt;">r-x</span></div>
</td>
<td style="width: 33%;">
<div style="font-size: x-small;" align="center"><span style="font-size: 12pt;">5 (4+1)</span></div>
</td>
</tr>
<tr>
<td style="width: 31%;">
<div style="font-size: x-small;" align="center"><span style="font-size: 12pt;">rw-</span></div>
</td>
<td style="width: 33%;">
<div style="font-size: x-small;" align="center"><span style="font-size: 12pt;">6 (4+2)</span></div>
</td>
</tr>
<tr>
<td style="width: 31%;">
<div style="font-size: x-small;" align="center"><span style="font-size: 12pt;">rwx</span></div>
</td>
<td style="width: 33%;">
<div style="font-size: x-small;" align="center"><span style="font-size: 12pt;">7 (4+2+1)</span></div>
</td>
</tr>
</tbody>
</table>
<p style="text-align: justify;"><br /> If you want to give full access to the owner, only read and execute to the group, and only execute to everyone else, you'd work it out like this :</p>
<p><strong>owner: </strong>rwx = 4 + 2 + 1 = 7</p>
<p><strong>group</strong><span><strong>:</strong></span> r-x = 4 + 0 + 1 = 5</p>
<p><strong>everyone</strong><span style="font-weight: bold;">:</span> --x = 0 + 0 + 1 = 1</p>
<p>So your number will be <strong>751</strong>, <strong>7</strong> for <strong>owner</strong>, <strong>5</strong> for <strong>group</strong>, and <strong>1</strong> for <strong>everyone</strong>. The command will be '<em><strong>chmod 751 file.txt</strong></em>'. It's simple isn't it ?</p>
<p style="text-align: justify;">If you want to give full control to everyone using all possible combinations, you'd give them all 'rwx' which equals to the number '7', so the final three digit number would be '777':</p>
<p align="center"><img src="https://www.firewall.cx/images/stories/linux-introduction-file-permissions-6.gif" alt="linux-introduction-file-permissions-6" width="400" height="273" style="display: block; margin-left: auto; margin-right: auto;" /></p>
<p style="text-align: justify;">If on the other hand you decide not to give anyone any permission, you would use '000' (now nobody can access the file, not even you!). However, you can always change the permissions to give yourself read access, by entering<span> '</span><em><strong>chmod 400 file.txt'</strong>. </em></p>
<p style="text-align: justify;">For more details on the 'chmod' command, please take a look at the man pages.</p>
<p style="text-align: justify;">As we will see soon, the correct combination of user and group permissions will allow us to perform our work while keeping our data safe from the rest of the world.</p>
<p style="text-align: justify;">For example in order for a user or group to enter a directory, they must have at least <strong>read</strong> (<strong>r</strong>) and <strong>execute</strong> (<strong>x</strong>) permissions on the directory, otherwise access to it is denied:</p>
<p align="center"><img src="https://www.firewall.cx/images/stories/linux-introduction-file-permissions-7.gif" alt="linux-introduction-file-permissions-7" width="578" height="284" style="display: block; margin-left: auto; margin-right: auto;" /></p>
<p style="text-align: justify;">As seen here, user '<strong>mailman</strong>' is trying to access the '<strong>red-bulb</strong>' directory which belongs to user '<strong>david</strong>' and group '<strong>sys</strong>'. <strong>Mailman </strong>is not a member of the '<strong>sys</strong>' group and therefore can't access it. At the same time the folder's permissions allow neither the <strong>group </strong>nor <strong>everyone </strong>to access it.</p>
<p style="text-align: justify;">Now, what we did is alter the permission so '<strong>everyone</strong>' has at least read and execute permissions so they are able to enter the folder - let's check it out:</p>
<p align="center"><img src="https://www.firewall.cx/images/stories/linux-introduction-file-permissions-8.gif" alt="linux-introduction-file-permissions-8" width="578" height="284" /></p>
<p style="text-align: justify;">Here we see the '<strong>mailman</strong>' user successfully entering the '<strong>red-bulb</strong>' directory because <strong>everyone </strong>has read (r) and execute (x) access to it!</p>
<p style="text-align: justify;">The world of Linux permissions is pretty user friendly as long as you see from the right perspective :) Practice and reviewing the theory will certainly help you remember the most important information so you can perform your work without much trouble.</p>
<p style="text-align: justify;">If you happen to forget something, you can always re-visit us - any time of the day!</p>
<p style="text-align: justify;">Continuing on to our last page, we will provide you with a few links to some of the world's greatest Linux resources, covering Windows to Linux migration, various troubleshooting techniques, forums and much more that will surely be of help.</p>
<p>This completes our initial discussion on the Linux operating system. Visit our <a href="https://www.firewall.cx/operating-systems/linux-unix/linux-more-info.html" title="Finding More Information">Finding More Information</a> page to discover useful resources that will assist you in your Linux journey or visit our <a href="https://www.firewall.cx/operating-systems/linux-unix.html" title="Linux section">Linux section</a> to access more technical articles on the Linux operating system.</p>]]></description>
			<category>Linux - Unix</category>
			<pubDate>Thu, 21 Jul 2011 06:46:23 +1000</pubDate>
		</item>
		<item>
			<title>Advanced Linux Commands</title>
			<link>https://www.firewall.cx/operating-systems/linux-unix/linux-advanced-cmd.html</link>
			<guid isPermaLink="true">https://www.firewall.cx/operating-systems/linux-unix/linux-advanced-cmd.html</guid>
			<description><![CDATA[<p style="text-align: justify;">Now that you're done learning some of the <a href="https://www.firewall.cx/operating-systems/linux-unix/linux-cmd-line.html" target="_blank" title="Basic Linux commands">Basic Linux commands</a> and how to use them to <a href="https://www.firewall.cx/operating-systems/linux-unix/linux-installing-software.html" target="_blank" title="install Linux Software">install Linux Software</a>, it's time we showed you some of the other ways to work with Linux. Bear in mind that each distribution of Linux (Redhat, SUSE, Mandrake etc) will come with a slightly different GUI (Graphical User Interface) and some of them have done a really good job of creating GUI configuration tools so that you never need to type commands at the command line.</p>
<h2>Vi Editor</h2>
<p style="text-align: justify;">For example, if you want to edit a text file you can easily use one of the powerful GUI tools like Kate, Kwrite etc., which are all like notepad in Windows though much more powerful; they have features such as multiple file editing and syntax highlighting (if you open an HTML file it understands the HTML tags and highlights them for you). However, you can also use the very powerful <span style="color: #000080;"><strong>vi</strong> </span>editor.</p>
<p style="text-align: justify;">When first confronted by <strong>vi</strong> most users are totally lost, you open a file in&nbsp;<strong>vi</strong> (e.g vi document1) and try to type, but nothing seems to happen.. the system just keeps beeping!</p>
<p align="center"><img src="https://www.firewall.cx/images/stories/linux-introduction-avd-cmd-line-1.gif" alt="" width="578" height="466" style="display: block; margin-left: auto; margin-right: auto;" data-alt="linux-introduction-avd-cmd-line-1" /></p>
<p style="text-align: justify;">Well that's because vi functions in two modes, one is the command mode, where you can give vi commands such as open a file, exit, split the view, search and replace etc., and the other mode is the insert view where you actually type text!</p>
<p style="text-align: justify;">Don't be put off by the fact that vi doesn't have a pretty GUI interface to go with it, this is an incredibly powerful text editor that would be well worth your time learning... once you're done with it you'll never want to use anything else!</p>
<p style="text-align: justify;"><br /> Realising that most people would find vi hard to use straight off, there is a useful little walk-through tutorial that you can access by typing <em><strong>vimtutor</strong> </em>at a command line. The tutorial opens vi with the tutorial in it, and you try out each of the commands and shortcuts in vi itself. It's very easy and makes navigating around vi a snap. Check it out.</p>
<p align="center"><img src="https://www.firewall.cx/images/stories/linux-introduction-avd-cmd-line-2.gif" alt="" width="578" height="466" style="vertical-align: middle; display: block; margin-left: auto; margin-right: auto;" data-alt="linux-introduction-avd-cmd-line-2" /></p>
<h2>Grep</h2>
<p>Another very useful Linux command is the <strong><em>grep</em> </strong>command. This little baby searches for a string in any file. The <strong>grep</strong> command is frequently used in combination with other commands in order to search for a specific string. For example, if we wanted to check our web server's log file for a specific URL query or IP address, the 'grep' command would do this job just fine.</p>
<p>If, on the other hand, you want to find every occurence of 'hello world' in every <strong>.txt</strong> file you have, you would type <strong><em>grep "hello world" *.txt</em></strong></p>
<p>You'll see some very common command structures later on that utilise 'grep'. At the same time, you can go ahead and check grep's man page by typing <strong><em>man grep</em></strong> , it has a whole lot of very powerful options.</p>
<p align="center"><img src="https://www.firewall.cx/images/stories/linux-introduction-avd-cmd-line-3.gif" alt="linux-introduction-avd-cmd-line-3" width="578" height="466" style="display: block; margin-left: auto; margin-right: auto;" /></p>
<h2 style="text-align: justify;">PS - Process ID (PID) display</h2>
<p style="text-align: justify;">The <strong>ps </strong>command will show all the tasks you are currently running on the system, it's the equivalent of Windows Task Manager and you'll be happy to know that there are also GUI versions of 'ps'.</p>
<p style="text-align: justify;">If you're logged in as root in your Linux system and type <em><strong>ps -aux</strong></em> , you'll see all processes running on the system by every user, however, for security purposes, users will only be able to see processes owned by them when typing the same command.</p>
<p align="center"><img src="https://www.firewall.cx/images/stories/linux-introduction-avd-cmd-line-4.gif" alt="linux-introduction-avd-cmd-line-4" width="578" height="466" style="display: block; margin-left: auto; margin-right: auto;" /></p>
<p>Again, <strong><em>man ps</em></strong> will provide you with a bundle of options available by the command.</p>
<h2>Kill</h2>
<p style="text-align: justify;">The 'kill' command is complementary to the 'ps' command as it will allow you to terminate a process revealed with the previous command. In cases where a process is not responding, you would use the following syntax to effectively kill it: <strong><em>kill -9 pid</em></strong> where 'pid' is the Process ID (PID) that 'ps' displays for each task.</p>
<p align="center"><img src="https://www.firewall.cx/images/stories/linux-introduction-avd-cmd-line-5.gif" alt="linux-introduction-avd-cmd-line-5" width="578" height="284" style="display: block; margin-left: auto; margin-right: auto;" /></p>
<p style="text-align: justify;">In the above example, we ran a utility called 'bandwidth' twice which is shown as two different process IDs (7171 &amp; 13344) using the <strong><em>ps</em> </strong>command. We then attempted to kill one of them using the command&nbsp;<strong><em>kill -9 7171</em></strong> . The next time we ran the 'ps', the system reported that a process that was started with the './bandwidth' command had been previously killed.</p>
<p style="text-align: justify;">Another useful flag we can use with the 'kill' command is the -HUP. This neat flag won't kill the process but pause it and at the same time force it to reload its configuration. So, if you've got a service running and need to restart it because of changes made in its configuration file, then the -HUP flag will do just fine. Many people look at it as an alternative 'reload' command.</p>
<p style="text-align: justify;">The complete syntax to make use of the flag is: <strong><em>kill -HUP pid</em></strong> where 'pid' is the process ID number you can obtain using the 'ps' command, just as we saw in the previous examples.</p>
<h2>Chaining Commands, Redirecting Output, Piping</h2>
<p style="text-align: justify;">In Linux, you can chain groups of commands together with incredible ease, this is where the true power of the Linux command line exists, you use small tools, each of which does one little task and passes the output on to the next one.</p>
<p style="text-align: justify;">For example, when you run the <em><strong>ps aux</strong></em> command, you might see a whole lot of output that you cannot read in one screen, so you can use the pipe symbol ( | ) to send the output of 'ps' to 'grep' which will search for a string in that output. This is known as 'piping' as it's similar to plumbing where you use a pipe to connect two things together.</p>
<p align="center"><img src="https://www.firewall.cx/images/stories/linux-introduction-avd-cmd-line-6.gif" alt="linux-introduction-avd-cmd-line-6" width="578" height="284" style="display: block; margin-left: auto; margin-right: auto;" /></p>
<p style="text-align: justify;">Say you want to find the task 'antispam' : you can run <strong><em>ps aux | grep antispam</em></strong> . Ps 'pipes' its output to grep and it then searches for the string, showing you only the line with that text.</p>
<p style="text-align: justify;">If you wanted ps to display one page at a time you can pipe the output of ps to either <strong><em>more</em> </strong>or <strong><em>less</em> </strong>. The advantage of&nbsp;<em><strong>less</strong> </em>is that it allows you to scroll upwards as well. Try this:&nbsp;<strong><em>ps aux | less</em></strong> . Now you can use the cursors to scroll through the output, or use pageup, pagedown.</p>
<h2>Alias</h2>
<p style="text-align: justify;">The 'alias' command is very neat, it lets you make a shortcut keyword for another longer command. Say you don't always want to type <em><strong>ps aux | less</strong></em>, you can create an alias for it.. we'll call our alias command 'pl'. So you type<span>&nbsp;</span> <strong><em>alias pl='ps aux | less'</em></strong> .</p>
<p style="text-align: justify;">Now whenever you type&nbsp;<strong><em>pl </em></strong>, it will actually run&nbsp;<strong><em>ps aux | less<span style="color: #00ff00;"></span></em></strong> - Neat, is'nt it?</p>
<p align="center"><img src="https://www.firewall.cx/images/stories/linux-introduction-avd-cmd-line-7.gif" alt="linux-introduction-avd-cmd-line-7" width="578" height="284" style="display: block; margin-left: auto; margin-right: auto;" /></p>
<p style="text-align: justify;">&nbsp;</p>
<p>You can view the aliases that are currently set by typing <strong><em>alias</em></strong>:</p>
<p align="center"><img src="https://www.firewall.cx/images/stories/linux-introduction-avd-cmd-line-8.gif" alt="linux-introduction-avd-cmd-line-8" width="578" height="284" style="display: block; margin-left: auto; margin-right: auto;" /></p>
<p style="text-align: justify;">As you can see, there are quite a few aliases already listed for the 'root' account we are using. You'll be suprised to know that most Linux distributions automatically create a number of aliases by default - these are there to make your life as easy as possible and can be deleted anytime you wish.</p>
<h2>Output Redirection</h2>
<p style="text-align: justify;">It's not uncommon to want to redirect the output of a command to a text file for further processing. In the good old DOS operating system, this was achieved by using the '<strong>&gt;</strong>' operator. Even today, with the latest Windows operating systems, you would open a DOS command prompt and use the same method!</p>
<p style="text-align: justify;">The good news is that Linux also supports these functions without much difference in the command line.</p>
<p style="text-align: justify;">For example, if we wanted to store the listing of a directory into a file, we would type the following: <strong><em>ls &gt; dirlist.txt</em></strong>:</p>
<p align="center"><img src="https://www.firewall.cx/images/stories/linux-introduction-avd-cmd-line-9.gif" alt="linux-introduction-avd-cmd-line-9" width="578" height="284" style="display: block; margin-left: auto; margin-right: auto;" /></p>
<p style="text-align: justify;">As you can see, we've taken the output of 'ls' and redirected it to our file. Let's now take a look and see what has actually been stored in there by using the command <em><strong>cat dirlist.txt</strong></em> :</p>
<p align="center"><img src="https://www.firewall.cx/images/stories/linux-introduction-avd-cmd-line-10.gif" alt="linux-introduction-avd-cmd-line-10" width="578" height="284" style="display: block; margin-left: auto; margin-right: auto;" /></p>
<p style="text-align: justify;">As expected, the dirlist.txt file contains the output of our previous command. So you might ask yourself 'what if I need to append the results?' - No problem here, as we've already got you covered.</p>
<p style="text-align: justify;">When there's a need for appending files or results, as in DOS we simply use the double <em><strong>&gt;&gt;</strong></em> operator. By using the command it will append the new output to the file we have specified in the command line:</p>
<p align="center"><img src="https://www.firewall.cx/images/stories/linux-introduction-avd-cmd-line-11.gif" alt="linux-introduction-avd-cmd-line-11" width="578" height="284" style="display: block; margin-left: auto; margin-right: auto;" /></p>
<p style="text-align: justify;">The above example clearly shows the content of our file named 'document2' which is then appended to the previously created file 'dirlist.txt'. With the use of the 'cat' command, we are able to examine its contents and make sure the new data has been appended.</p>
<p style="text-align: justify;"><span style="color: #000080;"><strong>Note:</strong></span></p>
<p style="text-align: justify;">By default, the single <strong>&gt;</strong> will overwrite the file if it exists, so if you give the <em><strong>ls &gt; dirlist.txt</strong></em> command again, it will overwrite the first dirlist.txt. However, if you specify <em><strong>&gt;&gt; </strong> </em>it will add the new output below the previous output in the file. This is known as output redirection.</p>
<p style="text-align: justify;">In Windows and DOS you can only run one command at a time, however, in Linux you can run many commands simultaneously. For example, let's say we want to see the directory list, then delete all files ending with .txt, then see the directory list again.</p>
<p style="text-align: justify;">This is possible in Linux using one statement as follows : <strong><em>ls -l; rm -f *.txt; ls -l</em></strong> . Basically you separate each command using a semicolon, '<em><strong>;</strong></em>'. Linux then runs all three commands one after the other. This is also known as <span style="color: #000080;">command chaining</span>.</p>
<h2>Background Processes</h2>
<p style="text-align: justify;">If you affix an ampersand '&amp;' to the end of any command, it will run in the background and not disturb you, there is no equivalent for this in Windows and it is very useful because it lets you start a command in the background and run other tasks while waiting for that to complete.</p>
<p style="text-align: justify;">The only thing you have to keep in mind is that you will not see the output from the command on your screen since it is in the background, but we can redirect the output to a file the way we did two paragraphs above.</p>
<p style="text-align: justify;">For example, if you want to search through all the files in a directory for the word 'Bombadil', but you want this task to run in the background and not interrupt you, you can type this: <em><strong>grep "Bombadil" *.* &gt;&gt; results.txt&amp;</strong></em> . Notice that we've added the ampersand '&amp;' character to the end of the command, so it will now run in the background and place the results in the file <strong>results.txt</strong> . When you press enter, you'll see something like this :</p>
<p style="text-align: justify;"><strong><em>$ grep "Bombadil" *.* &gt;&gt; results.txt&amp;</em></strong></p>
<p style="text-align: justify;"><strong><em>[1] 1272</em></strong></p>
<p align="center"><img src="https://www.firewall.cx/images/stories/linux-introduction-avd-cmd-line-12.gif" alt="linux-introduction-avd-cmd-line-12" width="578" height="284" style="display: block; margin-left: auto; margin-right: auto;" /></p>
<p style="text-align: justify;">Our screen shot confirms this. We created a few new files that contained the string 'Bombadil' and then gave the command <em><strong>grep "Bombadil" *.* &gt;&gt; results.txt&amp;</strong> </em>. The system accepted our command and placed the process in the background using PID (Process ID) 14976. When we next gave the 'ls' command to see the listing of our directory we saw our new file 'results.txt' which, as expected, contained the files and lines where our string was found.</p>
<p style="text-align: justify;">If you run a '<span class="style1" style="font-style: italic;">ps</span>' while this is executing a very complex command that takes some time to complete, you'll see the command in the list. Remember that you can use all the modifiers in this section with any combination of Linux commands, that's what makes it so powerful. You can take lots of simple commands and chain, pipe, redirect them in such a way that they do something complicated!</p>
<p>Our next article covers <a href="https://www.firewall.cx/operating-systems/linux-unix/linux-file-folder-permissions.html" title="Linux File &amp; Folder Permissions">Linux File &amp; Folder Permissions</a>, alternatively you can visit our <a href="https://www.firewall.cx/operating-systems/linux-unix.html" title="Linux section">Linux section</a> for more linux related technical articles.</p>
<p>&nbsp;</p>
<p></p>
<p><br /><br /></p>]]></description>
			<category>Linux - Unix</category>
			<pubDate>Thu, 21 Jul 2011 06:02:40 +1000</pubDate>
		</item>
		<item>
			<title>Installing Software On Linux</title>
			<link>https://www.firewall.cx/operating-systems/linux-unix/linux-installing-software.html</link>
			<guid isPermaLink="true">https://www.firewall.cx/operating-systems/linux-unix/linux-installing-software.html</guid>
			<description><![CDATA[<p style="text-align: justify;">Installing software in Linux is very different from Windows for one very simple reason: most Linux programs come in 'source code' form. This allows you to modify any program (if you're a programmer) to suit your purposes! While this is incredibly powerful for a programmer, for most of us who are not- we just want to start using the program!</p>
<p style="text-align: justify;">Most programs will come 'zipped' just like they do in Windows, in other words they pack all the files together into one file and compress it to a more manageable size. Depending on the zipping program used, the method of unzipping may vary, however, each program will have step by step instructions on how to unpack it.</p>
<p style="text-align: justify;">Most of the time the 'tar' program will be used to unpack a package and unzipping the program is fairly straightforward. This is initiated by typing '<em>tar -zxvf file-to-unzip.tgz</em>' where 'file-to-unzip.tgz' is the actual filename you wish to unzip. We will explain the four popular options we've used (zxvf) but you can read the '<em>tar man</em>' page if you are stuck or need more information.</p>
<p style="text-align: justify;">As mentioned, the '<strong>tar</strong>' program is used to unpack a package we've downloaded and would like to install. Because most packages use 'tar' to create one file for easy downloads, gzip (Linux's equivalent to the Winzip program) is used to compress the tar file (.gz), reducing the size and making it easier to transfer. This also explains the reason most files have extensions such as '.tgz' or '.tar.gz'.</p>
<p style="text-align: justify;">To make life easy, instead of giving two commands to decompress (unzip) and unpack the package, we provide tar with the -z option to automatically unzip to package and then proceed with unpacking it (-x). Here are the options in greater detail:</p>
<p style="text-align: justify;"><strong>-z</strong> : Unzip tar package before unpacking it.</p>
<p style="text-align: justify;"><strong>-x</strong> : Extract/Unpack the package</p>
<p style="text-align: justify;"><strong>-v</strong> : Verbosely list files processed</p>
<p style="text-align: justify;"><strong>-f</strong> : use archive file (filename provided)</p>
<p align="center"><img src="https://www.firewall.cx/images/stories/linux-introduction-installing-software-1.gif" alt="linux-introduction-installing-software-1" width="578" height="284" style="display: block; margin-left: auto; margin-right: auto;" /></p>
<p style="text-align: justify;">Because the list of files was long, we've cut the bottom part to make it fit in our small window.</p>
<p style="text-align: justify;">Once you have unzipped the program, go into its directory and look for a file called INSTALL, most programs will come with this file. It contains detailed instructions on how to install it, including the necessary commands to be typed, depending on the Linux distribution you have. After you've got that out of the way, you're ready to use the <span style="font-style: italic;">three magic commands</span> that install 99% of all software in Linux :)</p>
<p style="text-align: justify;">Open the program directory and type <strong><em>./configure</em></strong>. [<span style="color: #000080;">1st magic command</span>]</p>
<p align="center"><img src="https://www.firewall.cx/images/stories/linux-introduction-installing-software-2.gif" alt="linux-introduction-installing-software-2" width="578" height="284" style="display: block; margin-left: auto; margin-right: auto;" /></p>
<p style="text-align: justify;">You'll see a whole lot of output that you may not understand; this is when the software you're installing is automatically checking your system to analyze the options that will work best. Unlike the Windows world, where programs are made to work on a very general computer, Linux programs automatically customize themselves to fit your system.</p>
<p style="text-align: justify;">Think of it as the difference between buying ready-made clothes and having tailor made clothes especially designed for you. This is one of the most important reasons why programs are in the 'source code' form in Linux.</p>
<p style="text-align: justify;">In some cases, the <strong><em>./configure</em></strong> command will not succeed and will produce errors that will not allow you to take the step and compile your program. In these cases, you must read the errors, fix any missing library files (most common causes) or problems and try again:</p>
<p align="center"><img src="https://www.firewall.cx/images/stories/linux-introduction-installing-software-3.gif" alt="linux-introduction-installing-software-3" width="578" height="284" style="display: block; margin-left: auto; margin-right: auto;" /></p>
<p style="text-align: justify;" align="left">As you can see, we've run into a few problems while trying to configure this program on our lab machine, so we looked for a different program that would work for the purpose of this demonstration!</p>
<p align="center"><img src="https://www.firewall.cx/images/stories/linux-introduction-installing-software-4.gif" alt="linux-introduction-installing-software-4" width="578" height="284" style="display: block; margin-left: auto; margin-right: auto;" /></p>
<p style="text-align: justify;" align="center">&nbsp;</p>
<p>This <em><strong><span class="style1">./configure</span></strong></em> finished without any errors, so the next step is to type <em><strong>make</strong></em>. [<span style="color: #000080;">2nd magic command</span>]</p>
<p align="center"><img src="https://www.firewall.cx/images/stories/linux-introduction-installing-software-5.gif" alt="linux-introduction-installing-software-5" width="578" height="284" style="display: block; margin-left: auto; margin-right: auto;" /></p>
<p style="text-align: justify;">This simple command will magically convert the source code into a useable program... the best analogy of this process is that in the source code are all the ingredients in a recipe, if you understand programming, you can change the ingredients to make the dish better. Typing the&nbsp;<strong><em>make</em></strong> command takes the ingredients and cooks the whole meal for you! This process is known as 'compiling' the program</p>
<p style="text-align: justify;">If <strong><em><span class="style1">make</span></em></strong> finishes successfully, you will want to put all the files into the right directories, for example, all the help files in the help files directory, all the configuration files in the /etc directory (covered in the pages that follow).</p>
<p style="text-align: justify;">To perform this step, you have to log in as the superuser or 'root' account, if you don't know this password you can't do this.</p>
<p style="text-align: justify;">Assuming you are logged in as root, type <em><strong>make install</strong>. </em> [<span style="color: #000080;">3rd magic command</span>]</p>
<p align="center"><img src="https://www.firewall.cx/images/stories/linux-introduction-installing-software-6.gif" alt="linux-introduction-installing-software-6" width="578" height="284" style="display: block; margin-left: auto; margin-right: auto;" /></p>
<p style="text-align: justify;">Lastly, once our program has been configured, compiled and installed in /usr/local/bin with the name of 'bwn-ng', we are left with a whole bunch of extra files that are no longer useful, these can be cleaned using the <em><strong>make clean</strong></em> command - but this, as you might have guessed, is not considered a <span style="color: #000080;">magic command</span> :)</p>
<p align="center"><img src="https://www.firewall.cx/images/stories/linux-introduction-installing-software-7.gif" alt="linux-introduction-installing-software-7" width="578" height="284" style="display: block; margin-left: auto; margin-right: auto;" /></p>
<p style="text-align: justify;">&nbsp;There, that's it!</p>
<p style="text-align: justify;">Now here's the good news... that was the old hard way!</p>
<p style="text-align: justify;">All the people involved with Linux realised that most people don't need to read the source code and change the program and don't want to compile programs, so they have a new way of distributing programs in what is known as 'rpm' (<span style="font-weight: bold;">r</span>ed hat <span style="font-weight: bold;">p</span>ackage <span style="font-weight: bold;">m</span>anager) format.</p>
<p style="text-align: justify;">This is one single file of a pre-compiled program, you just have to double click the rpm file (in the Linux graphical interface - X) and it will install it on your system for you!</p>
<p style="text-align: justify;">In the event that you find a program that is not compiling with '<span class="style1">make</span>' you can search on the net (we recommend <a href="https://rpm.pbone.net/" target="_blank" rel="nofollow noopener" title="www.pbone.net">www.pbone.net </a>) for an rpm based on your Linux distribution and version. Installation then is simply one click away for the graphical X desktop, or one command away for the hardcore Linux enthusiasts!</p>
<p style="text-align: justify;">Because the 'rpm' utility is quite complex with a lot of flags and options, we would highly recommend you read its 'man' page before attempting to use it to install a program.</p>
<p style="text-align: justify;">One last note about rpm is that it will also check to see if there are any dependent programs or files that should or shouldn't be touched during an install or uninstall. By doing so, it is effectively protecting your operating system from accidentally overwriting or deleting a critical system file, causing a lot of problems later on!</p>
<p>For those looking for a challenge, our next article covers <a href="https://www.firewall.cx/operating-systems/linux-unix/linux-advanced-cmd.html" title="Advanced Linux Commands">Advanced Linux Commands</a> and explores commands most used with the administration of the Linux operating system. Alternatively you can visit our <a href="https://www.firewall.cx/operating-systems/linux-unix.html" title="Linux section">Linux section</a> to get access to a variaty of Linux articles.</p>]]></description>
			<category>Linux - Unix</category>
			<pubDate>Wed, 20 Jul 2011 16:55:24 +1000</pubDate>
		</item>
		<item>
			<title>The Linux Command Line </title>
			<link>https://www.firewall.cx/operating-systems/linux-unix/linux-cmd-line.html</link>
			<guid isPermaLink="true">https://www.firewall.cx/operating-systems/linux-unix/linux-cmd-line.html</guid>
			<description><![CDATA[<p style="text-align: justify;">You could actually skip this whole section for those who are already familiar with the topic, but we highly recommend you read it because this is the heart of Linux. We also advise you to go through this section while sitting in front of the computer.</p>
<p style="text-align: justify;" align="left">Most readers will be familiar with DOS in Windows and opening a DOS box. Well, let's put it this way.. comparing the power of the Linux command line with the power of the DOS prompt is like comparing a Ferrari with a bicycle!</p>
<p style="text-align: justify;" align="left">People may tell you that the Linux command line is difficult and full of commands to remember, but it's the same thing in DOS and just remember - you can get by in Linux without ever opening a command line (just like you can do all your work in Windows without ever opening a DOS box !). However, the Linux command line is actually very easy, logical and once you have even the slightest ability and fluency with it, you'll be amazed as to how much faster you can do complicated tasks than you would be able to with the fancy point-and-click graphics and mouse interface.</p>
<p style="text-align: justify;" align="left">To give you an example, imagine the number of steps it would take you in Windows to find a file that has the word "hello" at the end of a line, open that file, remove the first ten lines, sort all the other lines alphabetically and then print it. In Linux, you could achieve this with a single command! - Have we got your attention yet ?!</p>
<p style="text-align: justify;" align="left">Though you might wonder what you could achieve by doing this - the point is that you can do incredibly complicated things by putting together small commands, exactly like using small building blocks to make a big structure.</p>
<p style="text-align: justify;">We'll show you a few basic commands to move around the command line as well as their equivalents in Windows. We will first show you the commands in their basic form and then show you how you can see all the options to make them work in different ways.</p>
<h2>The Basic Commands</h2>
<p style="text-align: justify;">As a rule, note that anything typed<span> in </span>'<em>single quotes and italics</em>' is a valid Linux command to be typed at the command line, followed by Enter.</p>
<p style="text-align: justify;">We will use this rule throughout all our tutorials to avoid confusion and mistakes. Do not type the quotes and remember that, unlike Windows, Linux is case sensitive, thus typing ‘Document' is different from typing 'document'.</p>
<p style="text-align: justify;">&nbsp; <span style="color: #000080;"><strong>ls </strong></span>- You must have used the 'dir' command on Windows... well this is like 'dir' command on steroids! If you type '<em>ls</em>' and press enter you will see the files in that directory, there are many useful options to change the output. For example, '<em>ls -l</em>' will display the files along with details such as permissions (who can access a file), the owner of the file(s), date &amp; time of creation, etc.<span> The </span>'<em>ls</em>' command is probably the one command you will use more than any other on Linux. In fact, on most Linux systems you can just type '<em>dir</em>' and get away with it, but you will miss out on the powerful options of the '<em>ls</em>' command.</p>
<p align="center"><img src="https://www.firewall.cx/images/stories/linux-introduction-cmd-line-1.gif" alt="linux-introduction-cmd-line-1" width="583" height="284" style="display: block; margin-left: auto; margin-right: auto;" /></p>
<p style="text-align: justify;" align="center">&nbsp;</p>
<p style="text-align: justify;">&nbsp; <strong><span style="color: #000080;">cd</span> - </strong>This is the same as the DOS command: it changes the directory you are working in. Suppose you are in the '/var/cache' directory and want to go to its subfolder 'samba' , you can type '<em>cd samba</em>' just as you would if it were a DOS system.</p>
<p align="center"><img src="https://www.firewall.cx/images/stories/linux-introduction-cmd-line-2.gif" alt="linux-introduction-cmd-line-2" width="583" height="284" style="display: block; margin-left: auto; margin-right: auto;" /></p>
<p style="text-align: justify;">Imagine you were at the '/var/cache' directory and you wanted to change to the '/etc/init.d' directory in one step, you could just type '<em>cd /etc/init.d</em>' as shown above. On the other hand, if you just type '<em>cd</em>' and press enter, it will automatically take you back to your personal home directory (this is very useful as all your files are usually stored there).</p>
<p style="text-align: justify;">We also should point out that while Windows and DOS use the well known back-slash ' <strong>\</strong> ' in the full path address, Linux differentiates by using the forward-slash '<strong> /</strong> '. This explains why we use the command '<em>cd /etc/init.d</em>' and <strong>not</strong> '<em>cd \etc\init.d</em>' as most Windows users would expect.</p>
<p style="text-align: justify;">&nbsp; <span style="color: #000080;"><strong>pwd</strong> </span>- This will show you the directory you are currently in, should you forget. It's almost like asking the operating system 'Where am I right now ?'. It will show you the '<span style="color: #000080;"><strong>p</strong></span>resent <span style="color: #000080;"><strong>w</strong></span>orking <span style="color: #000080;"><strong>d</strong></span>irectory'.</p>
<p align="center"><img src="https://www.firewall.cx/images/stories/linux-introduction-cmd-line-3.gif" alt="linux-introduction-cmd-line-3" width="583" height="284" style="display: block; margin-left: auto; margin-right: auto;" /></p>
<p style="text-align: justify;" align="center">&nbsp;</p>
<p style="text-align: justify;">&nbsp; <span style="color: #000080;"><strong>cp - </strong></span> This is the equivalent of the Windows 'copy' command. You use it to copy a file from one place to another. So if you want to copy a file called 'document' to another file called 'document1' , you would need to type '<em>cp document document1</em>'. In other words, first the source, then the destination.</p>
<p align="center"><img src="https://www.firewall.cx/images/stories/linux-introduction-cmd-line-4.gif" alt="linux-introduction-cmd-line-4" width="583" height="284" style="display: block; margin-left: auto; margin-right: auto;" /></p>
<p style="text-align: justify;">The 'cp' command will also allow you to provide the path to copy it to. For example, if you wanted to copy 'document' to the home directory of <em>user1</em>, you would then type '<em>cp document /home/user1/</em>'. If you want to copy something to your home directory, you don't need to type the full path (example /home/yourusername), you can use the shortcut '~' (tilda), so to copy 'document' to your home directory, you can simply type '<em>copy document ~</em>' .</p>
<p style="text-align: justify;">&nbsp;</p>
<p style="text-align: justify;">&nbsp; <strong><span style="color: #000080;">rm </span>- </strong> This is the same as the <span>'del' or 'delete' </span> command in Windows. It will delete the files you input. So if you need to delete a file named 'document', you type '<em>rm document'</em>. The system will ask if you are sure, so you get a second chance! If you typed <span>'</span><em>rm –f</em><span><em>'</em> </span>then you will force (-f) the system to execute the command without requiring confirmation, this is useful when you have to delete a large number of files.</p>
<p align="center"><img src="https://www.firewall.cx/images/stories/linux-introduction-cmd-line-5.gif" alt="linux-introduction-cmd-line-5" width="578" height="284" style="display: block; margin-left: auto; margin-right: auto;" /></p>
<p style="text-align: justify;">In all Linux commands you can use the '*' wildcard that you use in Windows, so to delete all files ending with .txt in Windows you would type '<strong>del *.txt</strong><span>' </span>whereas in Linux you would type '<em>rm -f *.txt</em>'<em>. </em>Remember, we used the '<strong>-f</strong>' flag because we don't want to be asked to confirm the deletion of each file.</p>
<p align="center"><img src="https://www.firewall.cx/images/stories/linux-introduction-cmd-line-6.gif" alt="linux-introduction-cmd-line-6" width="578" height="284" style="display: block; margin-left: auto; margin-right: auto;" /></p>
<p style="text-align: justify;">To delete a folder, you have to give rm the '<strong>-r</strong>' (recursive) option; as you might have already guessed, you can combine options like this: '<em>rm -rf mydirectory</em>'. This will delete the directory 'mydirectory' (and any subdirectories within it) and will not ask you twice. Combining options like this works for all Linux commands.</p>
<p style="text-align: justify;" align="left">&nbsp;</p>
<p style="text-align: justify;"><span style="color: #000080;"><strong>mkdir / rmdir</strong></span> - These two commands are the equivalent of Windows' 'md' and 'rd', which allow you to create (md) or remove (rd) a directory. So if you type '<em>mkdir firewall</em>', a directory will be created named 'firewall'. On the other hand, type '<em>rmdir firewall</em>' and the newly created directory will be deleted. We should also note that the '<em>rmdir</em>' command will only remove an empty directory, so you might be better off using '<em>rm -rf</em>' as described above.</p>
<p align="center"><img src="https://www.firewall.cx/images/stories/linux-introduction-cmd-line-7.gif" alt="linux-introduction-cmd-line-7" width="578" height="284" style="display: block; margin-left: auto; margin-right: auto;" /></p>
<p style="text-align: justify;" align="center">&nbsp;</p>
<p style="text-align: justify;"><span style="color: #000080;"><strong>mv - </strong></span> This is the same as the 'move' command on Windows. It works like the '<strong>cp</strong>' or copy command, except that after the file is copied, the original source file is deleted. By the way, there is no rename command on Linux because technically moving and renaming a file is the same thing!</p>
<p style="text-align: justify;">In this example, we recreated the<span> '<strong>firewall</strong>'</span> directory we deleted previously and then tried renaming it to '<strong>firewall-cx</strong>'. Lastly, the new directory was moved to the '/var' directory:</p>
<p align="center"><img src="https://www.firewall.cx/images/stories/linux-introduction-cmd-line-8.gif" alt="linux-introduction-cmd-line-8" width="578" height="284" style="display: block; margin-left: auto; margin-right: auto;" /></p>
<p style="text-align: justify;">That should be enough to let you move around the command line or the 'shell', as it's known in the Linux community. You'll be pleased to know that there are many ways to open a shell window from the ‘X' graphical desktop, which can be called an xterm, or a terminal window.</p>
<p style="text-align: justify;">&nbsp; <span style="color: #000080;"><strong>cat</strong> </span>/ <span style="color: #000080;"><strong>more</strong> </span>/ <strong><span style="color: #000080;">less </span>- </strong> These commands are used to view files containing text or code. Each command will allow you to perform a special function that is not available with the others so, depending on your work, some might be used more frequently than others.</p>
<p style="text-align: justify;">The '<em>cat</em>' command will show you the contents of any file you select. This command is usually used in conjunction with other advanced commands such as '<em>grep</em>' to look for a specific string inside a large file which we'll be looking at later on.</p>
<p style="text-align: justify;">When issued, the 'cat' command will run through the file without pausing until it reaches the end, just like a file scanner that examines the contents of a file while at the same time showing the output on your screen:</p>
<p align="center"><img src="https://www.firewall.cx/images/stories/linux-introduction-cmd-line-9.gif" alt="linux-introduction-cmd-line-9" width="578" height="284" style="display: block; margin-left: auto; margin-right: auto;" /></p>
<p style="text-align: justify;">In this example, we have a whopper 215kb text file containing the system's messages. We issued the '<em>cat messages</em>' command and the file's content is immediately listed on our screen, only this went on for a minute until the 'cat' command reached the end of the file and then exited.</p>
<p style="text-align: justify;">Not much use for this example, but keep in mind that we usually pipe the output to other commands in order to give us some usable results :)</p>
<p style="text-align: justify;">'<em>more</em>' is used in a similar way, but will pause the screen when it has filled with text, in which case we need to hit the space bar or enter key to continue scrolling per page or line. The 'up' or 'down' arrow keys are of no use for this command and will not allow you to scroll through the file - it's pretty much a one way scrolling direction (from the beginning to the end) with the choice of scrolling per page (space bar) or line (enter key).</p>
<p style="text-align: justify;">The '<em>less</em>' command is an enhanced version of '<em>more</em>', and certainly more useful. With the less command, you are able to scroll up or down a file's content. To scroll down per page, you can make use of the space bar, or <strong>CTRL-D</strong>. To scroll upwards towards the beginning of the file, use <strong>CTRL-U</strong>.</p>
<p style="text-align: justify;">It is not possible for us to cover all the commands and their options because there are thousands! However, we will teach you the secret to using Linux -- that is, how to find the right tool (command) for a job, and how to find help on how to use it.</p>
<h2>Can I Have Some Help Please?</h2>
<p style="text-align: justify;">To find help on a command, you type the command name followed by '<em>--help</em>'<em>. </em>For example, to get help on the '<em>mkdir</em>' command, you will type '<em>mkdir --help</em>'<em>. </em>But there is a much more powerful way...</p>
<p style="text-align: justify;">For those who read our previous section, remember we told you that Linux stores all files according to their function? Well Linux stores the manuals (help files) for every program installed, and the best part is that you can look up the 'man pages' (manuals) very easily. All the manuals are in the same format and show you every possible option for a command.</p>
<p style="text-align: justify;">To open the manual of a particular command, type '<em>man</em>' followed by the command name, so to open the manual for '<span>mkdir</span>' type '<em>man mkdir</em>':</p>
<p align="center"><img src="https://www.firewall.cx/images/stories/linux-introduction-cmd-line-10.gif" alt="linux-introduction-cmd-line-10" width="578" height="284" style="display: block; margin-left: auto; margin-right: auto;" /></p>
<p style="text-align: justify;">Interestingly, try getting help on the 'man' command itself by typing '<em>man man</em>'<em>. </em> This is the most authoritative and comprehensive source of help for anything you have in Linux, and the best part is that every program will come with its manual! Isn't this so much better than trying to find a help file or readme.txt file :) ?</p>
<p style="text-align: justify;">Here's another incredibly useful command -- if you know the task you want to perform, but don't know the command or program to use, use the '<em>apropos</em>' command. This command will list all the programs on the system that are related to the task you want to perform. For example, say you want to send email but don't know the email program, you can type '<em>apropos email</em>' and receive a list of all the commands and programs on the system that will handle email! There is no equivalent of this on Windows.</p>
<h2>Searching for Files in Linux?</h2>
<p style="text-align: justify;">Another basic function of any operating system is knowing how to find or search for a missing or forgotten file, and if you have already asked yourself this question, you'll be pleased to find out the answer :)</p>
<p style="text-align: justify;">The simplest way to find any file in Linux is to type '<em>locate</em>' followed by the filename. So if you want to find a file called '<span>document</span>' , you type '<em>locate document</em>'. The locate command works using a database that is usually built when you are not using your Linux system, indexing all your files and directories to help you locate them.</p>
<p style="text-align: justify;">You can use the more powerful '<em>find</em>' command, but I would suggest you look at its '<span>man</span>' page first by typing '<em>man find</em>'. The '<em>find</em>' command differs from the '<em>locate</em>' command in that it does not use a database, but actually looks for the file(s) requested by scanning the whole directory or file system depending on where you execute the command.</p>
<p style="text-align: justify;">Logically, the '<em>locate</em>' command is much faster when looking for a file that has already been indexed in its database, but will fail to discover any new files that have just been installed since they haven't been indexed! This is where the '<em>find</em>' command comes to the rescue!</p>
<p>Our next article covers&nbsp;&nbsp;<a href="https://www.firewall.cx/operating-systems/linux-unix/linux-installing-software.html" title="Installing Software on Linux">Installing Software on Linux</a>, alternatively you can head back to our <a href="https://www.firewall.cx/operating-systems/linux-unix.html" title="Linux Section">Linux Section</a>.</p>
<p>&nbsp;</p>]]></description>
			<category>Linux - Unix</category>
			<pubDate>Tue, 19 Jul 2011 03:39:22 +1000</pubDate>
		</item>
		<item>
			<title>The Linux File System</title>
			<link>https://www.firewall.cx/operating-systems/linux-unix/linux-file-system.html</link>
			<guid isPermaLink="true">https://www.firewall.cx/operating-systems/linux-unix/linux-file-system.html</guid>
			<description><![CDATA[<p>A file system is nothing more than the way the computer stores and retrieves all your files. These files include your documents, programs, help files, games, music etc. In the Windows world we have the concept of files and folders.</p>
<p style="text-align: justify;">A folder (also known as a directory) is nothing more than a container for different files so that you can organise them better. In Linux, the same concept holds true -- you have files, and you have folders in which you organise these files.</p>
<p style="text-align: justify;">The difference is that Windows stores files in folders according to the program they belong to (in most cases), in other words, if you install a program in Windows, all associated files -- such as the .exe file that you run, the help files, configuration files, data files etc. go into the same folder. So if you install for example Winzip, all the files relating to it will go into one folder, usually c:\Program Files\Winzip.</p>
<p style="text-align: justify;">In Linux however, files are stored based on the <strong>function </strong> they perform. In other words, all help files for all programs will go into one folder made just for help files, all the executable (.exe) files will go into one folder for executable programs, all programs configuration files will go into a folder meant for configuration files.</p>
<p style="text-align: justify;">This layout has a few significant advantages as you always know where to look for a particular file. For example, if you want to find the configuration file for a program, you'll bound to find it in the actual program's installation directory.</p>
<p style="text-align: justify;">With the Windows operating system, it's highly likely the configuration file will be placed in the installation directory or some other Windows system subfolder. In addition, registry entries is something you won't be able to keep track of without the aid of a registry tracking program - something that does not exist in the Linux world since there is no registry!</p>
<p style="text-align: justify;">Of course in Linux everything is configurable to the smallest level, so if you choose to install a program and store all its files in one folder, you can, but you will just complicate your own life and miss out on the benefits of a file system that groups files by the function they perform rather than arbitrarily.</p>
<p style="text-align: justify;">Linux uses an hierarchical file system, in other words there is no concept of 'drives' like c: or d:, everything starts from what is called the ‘/' directory (known as the <em>root </em> directory). This is the top most level of the file system and all folders are placed at some level from here. This is how it looks:</p>
<p><img src="https://www.firewall.cx/images/stories/linux-introduction-file-system-1.gif" alt="linux-introduction-file-system-1" width="373" height="483" style="margin: 5px; float: left;" /></p>
<p style="text-align: justify;">&nbsp;As a result of files being stored according to their function on any Linux system, you will see many of the same folders. <br /><br />These are 'standard' folders that have been pre-designated for a particular purpose. For example the 'bin' directory will store all executable programs (the equivalent of Windows ‘.exe ' files).<br /><br />Remember also that in Windows you access directories using a backslash (eg c:\Program Files) whereas in Linux you use a forward slash (eg: <span style="color: #000080;">/bin</span> ).<br /><br />In other words you are telling the system where the directory is in relation to the root or top level folder.<br /><br />So to access the cdrom directory according to the diagram on the left you would use the path<span style="color: #000080;"> /mnt/cdrom</span>. <br /><br />To access the home directory of user 'sahir' you would use <span style="color: #000080;">/home/sahir</span>.</p>
<p style="text-align: justify;">&nbsp;</p>
<p style="text-align: justify;">&nbsp;</p>
<p style="text-align: justify;">&nbsp;</p>
<p style="text-align: justify;">&nbsp;</p>
<p style="text-align: justify;">So it's now time to read a bit about each directory function to help us get a better understanding of the operating system:<br /><br />•&nbsp;<strong><span style="color: #99ccff;"><span style="color: #000080;">bin</span> </span></strong>- This directory is used to store the system's executable files. Most users are able to access this directory as it does not usually contain system critical files. <br /><br />•&nbsp;<span style="color: #99ccff;"><strong><span style="color: #000080;">etc</span> </strong></span>- This folder stores the configuration files for the majority of services and programs run on the machine. These configuration files are all plain text files that you can open and edit the configuration of a program instantly. Network services such as samba (Windows networking), dhcp, http (apache web server) and many more, rely on this directory! You should be careful with any changes you make here. <br /><br />•&nbsp;<strong><span style="color: #99ccff;"><span style="color: #000080;">home</span> </span></strong>- This is the directory in which every user on the system has his own personal folder for his own personal files. Think of it as similar to the 'My Documents' folder in Windows. We've created one user on our test system by the name of 'sahir' - When Sahir logs into the system, he'll have full access to his home directory. <br /><br />•&nbsp;<span style="color: #99ccff;"><strong><span style="color: #000080;">var</span> </strong></span>- This directory is for any file whose contents change regularly, such as system log files - these are stored in /var/log. Temporary files that are created are stored in the directory /var/tmp. <br /><br />•&nbsp;<strong><span style="color: #99ccff;"><span style="color: #000080;">usr</span> </span></strong>- This is used to store any files that are common to all users on the system. For example, if you have a collection of programs you want all users to access, you can put them in the directory /usr/bin. If you have a lot of wallpapers you want to share, they can go in /usr/wallpaper. You can create directories as you like. <br /><br />•&nbsp;<span style="color: #99ccff;"><strong><span style="color: #000080;">root</span> </strong></span>- This can be confusing as we have a top level directory ‘/' which is also called ‘the root folder'. <br /><br />The 'root' (/root) directory is like the 'My Documents' folder for a very special user on the system - the system's Administrator, equivalent to Windows 'Administrator' user account.<br /><br />This account has access to any file on the system and can change any setting freely. Thus it is a very powerful account and should be used carefully. As a good practice, even if you are the system Administrator, you should not log in using the root account unless you have to make some configuration changes. <br /><br />It is a better idea to create a 'normal' user account for your day-to-day tasks since the 'root' account is the account for which hackers always try to get the password on Linux systems because it gives them unlimited powers on the system. You can tell if you are logged in as the root account because your command prompt will have a hash '#' symbol in front, while other users normally have a dollar '<strong>$</strong>' symbol. <br /><br />•&nbsp;<span style="color: #99ccff;"><strong><span style="color: #000080;">mnt</span> </strong></span>- We already told you that there are no concepts of 'drives' in Linux. So where do your other hard-disks (if you have any) as well as floppy and cdrom drives show up? <br /><br />Well, they have to be 'mounted' or loaded for the system to see them. This directory is a good place to store all the 'mounted' devices. Taking a quick look at our diagram above, you can see we have mounted a cdrom device so it is showing in the /mnt directory. You can access the files on the cdrom by just going to this directory!<br /><br />•&nbsp;<span style="color: #99ccff;"><strong><span style="color: #000080;">dev</span> </strong></span>- Every system has its devices, and the Linux O/S is no exeption to this! All your systems devices such as com ports, parallel ports and other devices all exist in /dev directory as files and directories! You'll hardly be required to deal with this directory, however you should be aware of what it contains.<br /><br />•&nbsp;<span style="color: #99ccff;"><strong><span style="color: #000080;">proc</span> </strong></span>- Think of the /proc directory as a deluxe version of the Windows Task Manager. The /proc directoy holds all the information about your system's processes and resources. Here again, everything exists as a file and directory, something that should't surprise you by now!<br /><br />By examining the appropriate files, you can see how much memory is being used, how many tcp/ip sessions are active on your system, get information about your CPU usage and much more. All programs displaying information about your system use this directory as their source of information! <br /><br />•&nbsp;<span style="color: #99ccff;"><strong><span style="color: #000080;">sbin</span> </strong></span>- The /sbin directory's role is that similar to the /bin directory we covered earlier, but with the difference its only accessible by the 'root' user. Reason for this restriction as you might have already guessed are the sensitive applications it holds, which generally are used for the system's configuration and various other important services. Consider it an equivelant to the Windows Administration tools folder and you'll get the idea.<br /><br />Lastly, if you've used a Linux system, you'll have noticed that not many files have an extension - that is, the three letters after the dot, as found in Windows and DOS: file1.txt , winword.exe , letter.doc. <br /><br />While you can name your files with extensions, Linux doesn't really care about the 'type' of file. There are very quick ways to instantly check the type of file anything is. You can even make just about any file in Linux an executable or .exe file at whim! <br /><br />Linux is smart enough to recognise the purpose of a file so you don't need to remember the meaning of different extensions.<br /><br />You have now covered the biggest hurdle faced by new Linux users. Once you get used to the file system you'll find it is a very well organised system that makes storing files a very logical process. There is a system and, as long as you follow it, you'll find most of your tasks are much simpler than other operating system tasks. Our next article, <a href="https://www.firewall.cx/operating-systems/linux-unix/linux-cmd-line.html" title="The Linux Command Line">The Linux Command Line</a> explores the Linux command, commands, options and much more. Alternativerly you can head back to our <a href="https://www.firewall.cx/operating-systems/linux-unix.html" target="_blank" title="Linux section">Linux section</a> to find more technical articles covering the Linux operating system.</p>]]></description>
			<category>Linux - Unix</category>
			<pubDate>Tue, 19 Jul 2011 02:51:54 +1000</pubDate>
		</item>
		<item>
			<title>Why Use Linux?</title>
			<link>https://www.firewall.cx/operating-systems/linux-unix/linux-why-use-linux.html</link>
			<guid isPermaLink="true">https://www.firewall.cx/operating-systems/linux-unix/linux-why-use-linux.html</guid>
			<description><![CDATA[<p>The first question is - what are the benefits of using Linux instead of Windows? This is in fact a constant debate between the Windows and Linux communities and while we won't be taking either side, you'll discover that our points will favour the Linux operating system because they are valid :)</p>
<p style="text-align: justify;">Of course, if you don't agree, our forums have a dedicated Linux section where we would happily discuss it with you!</p>
<h2>Reasons for using Linux ....</h2>
<p style="text-align: justify;">While we could list a billion technical reasons, we will focus on those that we believe will affect you most:</p>
<p><strong>Linux is free.</strong> That's right - if you never knew it, the Linux operating system is free of charge. No user or server licenses are required<span style="color: #ff0000;">*</span>! If, however, you walk into an IT shop or bookstore, you will find various Linux distributions on the shelf available for purchase, that cost is purely to cover the packaging and possible support available for the distribution.</p>
<p style="text-align: justify;"><span style="color: #ff0000;">*</span> We must note that the newer 'Advanced Linux Servers', now available from companies such as Redhat, actually charge a license fee because of the support and update services they provide for the operating system. In our opinion, these services are rightly charged since they are aimed at businesses that will use their operating system in critical environments where downtime and immediate support is non-negotiable.</p>
<p><strong>Linux is developed by hundreds of thousands of people worldwide</strong>. Because of this community development mode there are very fresh ideas going into the operating system and many more people to find glitches and bugs in the software than any commercial company could ever afford (yes, Microsoft included).</p>
<p><strong>Linux is rock solid and stable</strong>, unlike Windows, where just after you've typed a huge document it suddenly crashes, making you loose all your work!</p>
<p style="text-align: justify;">Runtime errors and crashes are quite rare on the Linux operating system due to the way its kernel is designed and the way processes are allowed to access it. No one can guarantee that your Linux desktop or server will not crash at all, because that would be a bit extreme, however, we can say that it happens a lot less frequently in comparison with other operating systems such as Windows.</p>
<p style="text-align: justify;">For the fanatics of the 'blue screen of death' - you'll be disappointed to find out there is no such thing in the world of Linux. However, not all is lost as there have been some really good 'blue screen of death' screen savers out for the Linux graphical X Windows system.</p>
<p style="text-align: justify;">You could also say that evidence of the operating system's stability is the fact that it's the most widely used operating system for running important services in public or private sectors. Worldwide statistics show that the number of Linux web servers outweigh by far all other competitors:</p>
<p align="center"><img src="https://www.firewall.cx/images/stories/linux-introduction-why-use-linux-1.gif" alt="linux-introduction-why-use-linux-1" width="550" height="255" style="display: block; margin-left: auto; margin-right: auto;" /></p>
<p style="text-align: justify;" align="left">Today, netcraft reports that for the month of June 2005, out of a total of 64,808,485 Web servers, 45,172,895 are powered by Apache while only 13,131,043 use Microsoft's IIS Web server!</p>
<p style="text-align: justify;"><strong>Linux is much more secure</strong> than Windows, there are almost no viruses for Linux and, because there are so many people working on Linux, whenever a bug is found, a fix is provided much more quickly than with Windows. Linux is much more difficult for hackers to break into as it has been designed from the ground up with security in mind.</p>
<p style="text-align: justify;"><strong>Linux uses less system resources</strong> than Windows. You don't need the latest, fastest computer to run Linux. In fact you can run a functional version of Linux from a floppy disk with a computer that is 5-6 years old! At this point, we can also mention that one of our lab firewalls still runs on a K6-266 -3DNow! processor with 512 MB Ram! Of course - no graphical interfaces are loaded as we only work on in CLI mode!</p>
<p style="text-align: justify;"><strong>Linux has been designed to put power into the hands of the user</strong> so that <strong>you </strong> have total control of the operating system and not the other way around. A person who knows how to use Linux has the computer far more 'by the horns' than any Windows user ever has.</p>
<p style="text-align: justify;"><strong>Linux is fully compatible with all other systems</strong>. Unlike Microsoft Windows, which is at its happiest when talking to other Microsoft products, Linux is not 'owned' by any company and thus it keeps its compatibility with all other systems. The simplest example of this is that a Windows computer cannot read files from a hard-disk with the Linux file system on it (ext2 &amp; ext3), but Linux will happily read files from a hard-disk with the Windows file system (fat, fat32 or ntfs file system), or for that matter any other operating system.</p>
<p style="text-align: justify;">Now that we've covered some of the benefits of using Linux, let's start actually focusing on the best way to ease your migration from the Microsoft world to the Linux world, or in case you already have a Linux server running - start unleashing its full potential!</p>
<p style="text-align: justify;">The first thing we will go over is the way Linux deals with files and folders on the hard-disk as this is completely different to the way things are done in Windows and is usually one of the challenges faced by Linux newbies.</p>
<p>&nbsp;</p>
<p></p>
<p><br /><br /></p>]]></description>
			<category>Linux - Unix</category>
			<pubDate>Tue, 19 Jul 2011 02:46:29 +1000</pubDate>
		</item>
	</channel>
</rss>
