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

<channel>
	<title>gHacks technology news &#187; hostname</title>
	<atom:link href="http://www.ghacks.net/tag/hostname/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.ghacks.net</link>
	<description>A technology blog covering software, mobile phones, gadgets, security, the Internet and other relevant areas.</description>
	<lastBuildDate>Tue, 24 Nov 2009 23:31:44 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.8.6</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>Set your hostname in Linux</title>
		<link>http://www.ghacks.net/2009/07/06/set-your-hostname-in-linux/</link>
		<comments>http://www.ghacks.net/2009/07/06/set-your-hostname-in-linux/#comments</comments>
		<pubDate>Mon, 06 Jul 2009 16:24:16 +0000</pubDate>
		<dc:creator>Jack Wallen</dc:creator>
				<category><![CDATA[Advice]]></category>
		<category><![CDATA[Linux]]></category>
		<category><![CDATA[Networks]]></category>
		<category><![CDATA[Open Source]]></category>
		<category><![CDATA[Server]]></category>
		<category><![CDATA[Tutorials Basic]]></category>
		<category><![CDATA[hostname]]></category>
		<category><![CDATA[setting hostname]]></category>

		<guid isPermaLink="false">http://www.ghacks.net/?p=13715</guid>
		<description><![CDATA[If you are an administrator then you know what a hostname is. If you are not an administrator then you should know the hostname of a computer is the name which a network attached device is known. Unless you have manually changed your hostname, or set it up during installation, your hostname will most likely [...]]]></description>
			<content:encoded><![CDATA[<p>If you are an administrator then you know what a hostname is. If you are not an administrator then you should know the hostname of a computer is the name which a network attached device is known. Unless you have manually changed your hostname, or set it up during installation, your hostname will most likely be &#8220;localhost.localdomain&#8221;.</p>
<p>Hostnames are most often used for administrative habits. In other words hostnames will show up in some scanning applications, can be used for name to IP address resolution, and much more. But to make this useful you will have to manually set your hostname on your Linux machine. This article will show you just how to do that.</p>
<p><span id="more-13715"></span><strong>Find your hostname</strong></p>
<p>The most common means to find your host name is to open up a terminal window and enter the command:</p>
<p><em>hostname</em></p>
<p>If you have not set your hostname, more than likely you will see returned:</p>
<p><em>localhost.localdomain</em></p>
<p>A quick and easy way to spot if you have not changed your hostname is to check when you open up your terminal window. At your bash prompt you will see something like:</p>
<p><code>[jlwallen@localhost ~]$</code></p>
<p>As you can see a portion of the hostname (everything preceding the first &#8220;.&#8221;) will be used in your prompt. In the example you see above you see &#8220;localhost&#8221; which should tell you the hostname has not been changed.</p>
<p><strong>Temporarily changing your hostname</strong></p>
<p>You can temporarily change your hostname by issuing a single command. You have to issue this command either using sudo or as the root user. To make this change you will use the same command you used to find out your hostname, only you will include the new hostname to the command. Say you want to change your hostname to &#8220;willow&#8221;. To make this change temporarily issue the command:</p>
<p><em>hostname willow</em></p>
<p>Now issue the command <em>hostname</em> which should report back:</p>
<p><strong>willow</strong></p>
<p>This change will last until you reboot your machine.</p>
<p><strong>Permanently changing your hostname</strong></p>
<p>How you permanently change your hostname will depending upon which distribution you use. We&#8217;ll examine making this change on both a Ubuntu system and a Fedora system. First Ubuntu.</p>
<p>On a Ubuntu system there is a file called <strong>/etc/hostname</strong>. The contents of this file will have a single line containing the hostname of your machine. Open up this file in your favorite editor, delete the default hostname, add your desired hostname, and save the file. To make this chang take effect issue the command:</p>
<p><em>/etc/init.d/hostname.sh start</em></p>
<p>This hostname will remain intact upon reboot.</p>
<p>Now to change your hostname in Fedora. This is taken care of in the <strong>/etc/sysconfig/network </strong>file. The default contents of this file will look like:</p>
<p><code>NETWORKING=yes<br />
HOSTNAME=localhost.localdomain</code></p>
<p>Erase the &#8220;localhost.localdomain&#8221; portion and change that to reflect the hostname you want. Once you have made this change save the file. Once you have made this change issue the following command (as the root user):</p>
<p><em>/etc/rc.d/rc.sysinit</em></p>
<p>For the change to take effect.</p>
<p><strong>Final thoughts</strong></p>
<p>With your hostname changed applications like <a title="Lanmap" href="http://www.ghacks.net/2009/06/19/map-your-network-with-lanmap/" target="_blank">Lanmap</a> will now be easier to use because machines will have unique names. This change will also make administering your systems easier because you will have set machine hostnames to reflect either the user of the machine or the machines&#8217; job.</p>

	Tags: <a href="http://www.ghacks.net/tag/hostname/" title="hostname" rel="tag">hostname</a>, <a href="http://www.ghacks.net/tag/linux/" title="Linux" rel="tag">Linux</a>, <a href="http://www.ghacks.net/tag/setting-hostname/" title="setting hostname" rel="tag">setting hostname</a><br />

	<h4>Related posts</h4>
	<ul class="st-related-posts">
	<li><a href="http://www.ghacks.net/2008/02/07/yoggie-pico-personal-mobile-security-computer/" title="Yoggie PICO Personal Mobile Security Computer (February 7, 2008)">Yoggie PICO Personal Mobile Security Computer</a> (3)</li>
	<li><a href="http://www.ghacks.net/2009/10/30/with-ubuntu-9-10-arrives-wubi-9-10/" title="With Ubuntu 9.10 Arrives Wubi 9.10 (October 30, 2009)">With Ubuntu 9.10 Arrives Wubi 9.10</a> (2)</li>
	<li><a href="http://www.ghacks.net/2006/12/07/widgets-for-linux-superkaramba/" title="Widgets for Linux: SuperKaramba (December 7, 2006)">Widgets for Linux: SuperKaramba</a> (6)</li>
	<li><a href="http://www.ghacks.net/2006/12/06/widgets-for-linux-gdesklets/" title="Widgets for Linux: gDesklets (December 6, 2006)">Widgets for Linux: gDesklets</a> (3)</li>
	<li><a href="http://www.ghacks.net/2006/12/20/why-you-should-switch-your-parents-pc-to-ubuntu/" title="Why you should switch your parents pc to ubuntu (December 20, 2006)">Why you should switch your parents pc to ubuntu</a> (20)</li>
</ul>

]]></content:encoded>
			<wfw:commentRss>http://www.ghacks.net/2009/07/06/set-your-hostname-in-linux/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
		</item>
	</channel>
</rss>
