<?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>Dan Bishop</title>
	<atom:link href="http://www.danbishop.org/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.danbishop.org</link>
	<description>Just another WordPress weblog</description>
	<lastBuildDate>Mon, 06 Feb 2012 13:17:12 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>Using hostapd to add wireless access point capabilities to an Ubuntu server.</title>
		<link>http://www.danbishop.org/2011/12/11/using-hostapd-to-add-wireless-access-point-capabilities-to-an-ubuntu-server/</link>
		<comments>http://www.danbishop.org/2011/12/11/using-hostapd-to-add-wireless-access-point-capabilities-to-an-ubuntu-server/#comments</comments>
		<pubDate>Sun, 11 Dec 2011 21:37:55 +0000</pubDate>
		<dc:creator>Dan Bishop</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.danbishop.org/?p=627</guid>
		<description><![CDATA[The first thing to do is find out whether your hardware is capable of running in master mode. The easiest way to check this is like so: sudo apt-get install iw iw list Look through the output to find the Supported Interface Modes section: ... Supported interface modes: * IBSS * managed * AP * [...]]]></description>
			<content:encoded><![CDATA[<div class="alignleft"><div class="g-plusone" data-href="http://www.danbishop.org/2011/12/11/using-hostapd-to-add-wireless-access-point-capabilities-to-an-ubuntu-server/" size="small" count="true"></div></div><p>The first thing to do is find out whether your hardware is capable of running in master mode. The easiest way to check this is like so:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">apt-get</span> <span style="color: #c20cb9; font-weight: bold;">install</span> iw
iw list</pre></div></div>

<p>Look through the output to find the Supported Interface Modes section:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">...
Supported interface modes:
         * IBSS
         * managed
         * AP
         * AP/VLAN
         * monitor
         * mesh point
...</pre></div></div>

<p>If, as in the example above, AP mode is listed, then congratulations you have everything you need! If not, all is not lost. Check out <a href="https://help.ubuntu.com/community/WifiDocs/MasterMode" onclick="pageTracker._trackPageview('/outgoing/help.ubuntu.com/community/WifiDocs/MasterMode?referer=');">this guide</a> to see how to test older hardware for master mode.</p>
<h2>HostAPD</h2>
<p>We&#8217;re going to use the hostapd service to manage our access point, the first thing to do is install, then configure it.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">apt-get</span> <span style="color: #c20cb9; font-weight: bold;">install</span> hostapd
<span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">nano</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>default<span style="color: #000000; font-weight: bold;">/</span>hostapd</pre></div></div>

<p>This will install hostapd and present you with the default service configuration. We need to modify this file to start hostapd at boot and tell it where we&#8217;ll store the config file. Do this by editing the DAEMON_CONF line like so:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">DAEMON_CONF=&quot;/etc/hostapd/hostapd.conf&quot;</pre></div></div>

<p>Now we need to create a config file at the location above:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">nano</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>hostapd<span style="color: #000000; font-weight: bold;">/</span>hostapd.conf</pre></div></div>

<p>Paste the following into it:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">ctrl_interface=/var/run/hostapd
###############################
# Basic Config
###############################
macaddr_acl=0
auth_algs=1
# Most modern wireless drivers in the kernel need driver=nl80211
driver=nl80211
##########################
# Local configuration...
##########################
interface=wlan0
bridge=br0
hw_mode=g
channel=1
ssid=danlan
macaddr_acl=0
auth_algs=1
ignore_broadcast_ssid=0
wpa=3
wpa_passphrase=DONOTFORGETTOCHANGEME
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP
rsn_pairwise=CCMP</pre></div></div>

<p>Most of the options above are fairly self-explantory, however, there are a few things to note. Firstly, &#8220;hw_mode=g&#8221; should be set as &#8220;g&#8221; even if you want an 802.11n access point. Furthermore, you need to set a WPA passphrase where indicated.</p>
<h2>Bridging the Connections</h2>
<p>Your AP is now configured and clients will be able to connect, however, they will not be assigned an IP and they will not be able to access the network on eth0. That&#8217;s where bridging comes in. This example assumes that your server has an eth0 connection to the network and wlan0 which is being used as the wireless AP.</p>
<p>First we need to install the bridge utilities:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">apt-get</span> <span style="color: #c20cb9; font-weight: bold;">install</span> bridge-utils</pre></div></div>

<p>Edit your /etc/network/interfaces file like so:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;"># This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
&nbsp;
# The loopback network interface
auto lo
iface lo inet loopback
&nbsp;
# The primary network interface
#auto eth0
#iface eth0 inet static
#       address 192.168.0.2
#       netmask 255.255.255.0
#       network 192.168.0.0
#       broadcast 192.168.0.255
#       gateway 192.168.0.1
&nbsp;
auto br0
iface br0 inet static
        address 192.168.0.2
        netmask 255.255.255.0
        network 192.168.0.0
        broadcast 192.168.0.255
        gateway 192.168.0.1
        bridge-ports eth0 wlan0</pre></div></div>

<p>Note that the new br0 interface effectively replaces your existing eth0 interface. If you&#8217;ve followed the Ubuntu SBS guide to configure DHCP then you&#8217;re done! Your new AP should be up and running after a simple reboot. If not, follow the DHCP Server section of the SBS guide on this site.</p>
 <p><a href="http://www.danbishop.org/?flattrss_redirect&amp;id=627&amp;md5=27c769dba2a1e7cc1f91410c2fa14ec0" title="Flattr" target="_blank"><img src="http://www.danbishop.org/wp-content/plugins/flattr/img/flattr-badge-large.png" alt="flattr this!"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.danbishop.org/2011/12/11/using-hostapd-to-add-wireless-access-point-capabilities-to-an-ubuntu-server/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<atom:link rel="payment" href="http://www.danbishop.org/?flattrss_redirect&amp;id=627&amp;md5=27c769dba2a1e7cc1f91410c2fa14ec0" type="text/html" />
	</item>
		<item>
		<title>How to batch convert PDFs to Jpgs</title>
		<link>http://www.danbishop.org/2011/11/28/how-to-batch-convert-pdfs-to-jpgs/</link>
		<comments>http://www.danbishop.org/2011/11/28/how-to-batch-convert-pdfs-to-jpgs/#comments</comments>
		<pubDate>Mon, 28 Nov 2011 11:30:39 +0000</pubDate>
		<dc:creator>Dan Bishop</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.danbishop.org/?p=603</guid>
		<description><![CDATA[This is mainly for my own future reference, but might be useful to others. First things first, I had to clean up the PDF filenames, some contained spaces, some did not. rename 'y/ /-/' * This will replace all spaces with hyphens (-). Now for the converting process: for i in `ls *.pdf`; do convert [...]]]></description>
			<content:encoded><![CDATA[<div class="alignleft"><div class="g-plusone" data-href="http://www.danbishop.org/2011/11/28/how-to-batch-convert-pdfs-to-jpgs/" size="small" count="true"></div></div><p>This is mainly for my own future reference, but might be useful to others. First things first, I had to clean up the PDF filenames, some contained spaces, some did not.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">rename <span style="color: #ff0000;">'y/ /-/'</span> <span style="color: #000000; font-weight: bold;">*</span></pre></div></div>

<p>This will replace all spaces with hyphens (-).</p>
<p>Now for the converting process:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">for</span> i <span style="color: #000000; font-weight: bold;">in</span> <span style="color: #000000; font-weight: bold;">`</span><span style="color: #c20cb9; font-weight: bold;">ls</span> <span style="color: #000000; font-weight: bold;">*</span>.pdf<span style="color: #000000; font-weight: bold;">`</span>; <span style="color: #000000; font-weight: bold;">do</span> convert <span style="color: #660033;">-density</span> <span style="color: #000000;">125</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$i</span>&quot;</span> <span style="color: #ff0000;">&quot;<span style="color: #007800;">$i</span>&quot;</span>.jpg; <span style="color: #000000; font-weight: bold;">done</span></pre></div></div>

<p>This will convert all .pdf files in the current directory. It requires imagemagik to be installed (on Ubuntu you will be given instructions on how to do this if it&#8217;s not already installed when you run the command).</p>
<p>The option &#8220;-density 125&#8243; can be adjusted to produce different sized Jpg files, the higher the number, the higher the resolution and consequently the file size.</p>
 <p><a href="http://www.danbishop.org/?flattrss_redirect&amp;id=603&amp;md5=ca987bbf055d8157aa7274ca9991bf07" title="Flattr" target="_blank"><img src="http://www.danbishop.org/wp-content/plugins/flattr/img/flattr-badge-large.png" alt="flattr this!"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.danbishop.org/2011/11/28/how-to-batch-convert-pdfs-to-jpgs/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<atom:link rel="payment" href="http://www.danbishop.org/?flattrss_redirect&amp;id=603&amp;md5=ca987bbf055d8157aa7274ca9991bf07" type="text/html" />
	</item>
		<item>
		<title>How to Build an Ubuntu 11.10 SBS (Small Business Server)</title>
		<link>http://www.danbishop.org/2011/10/29/ubuntu-11-10-sbs-small-business-server-setup-part-1-%e2%80%93-dhcp-and-dns/</link>
		<comments>http://www.danbishop.org/2011/10/29/ubuntu-11-10-sbs-small-business-server-setup-part-1-%e2%80%93-dhcp-and-dns/#comments</comments>
		<pubDate>Sat, 29 Oct 2011 10:23:02 +0000</pubDate>
		<dc:creator>Dan Bishop</dc:creator>
				<category><![CDATA[Software]]></category>
		<category><![CDATA[dhcp]]></category>
		<category><![CDATA[kerberos]]></category>
		<category><![CDATA[nfs]]></category>
		<category><![CDATA[openldap]]></category>
		<category><![CDATA[sbs]]></category>
		<category><![CDATA[server]]></category>
		<category><![CDATA[ssh]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://www.danbishop.org/?p=586</guid>
		<description><![CDATA[This guide will help you configure Ubuntu Server Edition 11.10 for a small/medium business. The server will provide DHCP, DNS, NTP, LDAP, Kerberos and NFS services such that users can login to any machine on the network and all their files and settings will be the same across the entire network. The first thing to [...]]]></description>
			<content:encoded><![CDATA[<div class="alignleft"><div class="g-plusone" data-href="http://www.danbishop.org/2011/10/29/ubuntu-11-10-sbs-small-business-server-setup-part-1-%e2%80%93-dhcp-and-dns/" size="small" count="true"></div></div><p>This guide will help you configure Ubuntu Server Edition 11.10 for a small/medium business. The server will provide DHCP, DNS, NTP, LDAP, Kerberos and NFS services such that users can login to any machine on the network and all their files and settings will be the same across the entire network.</p>
<p>The first thing to get your server to do is act as a DHCP and DNS server. This will allow you to map hostnames to IP addresses (and vice versa!) automatically. This means all network clients will know that neo.danbishop.org and 192.168.0.2 are one and the same. This is ESSENTIAL if you plan to use Kerberos later on.<span id="more-586"></span></p>
<p>Make sure you have disabled DHCP on your router and set a static IP address for the server. This is done by editing /etc/network/interfaces like so:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;"># This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).
&nbsp;
# The loopback network interface
auto lo
iface lo inet loopback
&nbsp;
# The primary network interface
auto eth0
iface eth0 inet static
        address 192.168.0.2
        netmask 255.255.255.0
        network 192.168.0.0
        broadcast 192.168.0.255
        gateway 192.168.0.1</pre></div></div>

<p>It&#8217;s time to configure resolv.conf so that your server (and soon clients) can query name servers other than your own. This way, when a client looks up an address outside of danbishop.org (google.co.uk for example) dnsmasq (the software we&#8217;ll be using for DHCP and DNS) will query the name servers in resolv.conf. Dnsmasq will then cache the IP for subsequent requests from any client speeding up DNS across your network <img src='http://www.danbishop.org/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>In this case we&#8217;re going to use our own DNS server as the primary DNS, followed by Google&#8217;s public DNS servers. You can of course substitute Google&#8217;s servers for your own ISP&#8217;s, or any other DNS server.</p>
<p>So time to edit /etc/resolv.conf:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">domain danbishop.org 
search danbishop.org 
nameserver 192.168.0.2
nameserver 8.8.8.8 
nameserver 8.8.4.4</pre></div></div>

<p>Now it&#8217;s time to install Dnsmasq:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">apt-get</span> <span style="color: #c20cb9; font-weight: bold;">install</span> dnsmasq</pre></div></div>

<p>Dnsmasq will take care of both DNS and DHCP for your network. We will configure it so that as it allocates IP addresses to clients on the network, it also adds them into its DNS server. This way both forward and reverse lookups will work on any machine, as required by Kerberos <img src='http://www.danbishop.org/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>The configuration file for Dnsmasq (/etc/dnsmasq.conf) is HUGE. However it is VERY well commented making it very easy to play around. The important things for this guide are:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">domain=danbishop.org				#sets the domain name you're going to use
dhcp-range=192.168.0.50,192.168.0.150,12h	#sets the range from which to allocate IP addresses to clients and the lease time
dhcp-option=option:router,192.168.0.1		#sets the IP address of the router (gateway address) to be given to clients
dhcp-option=option:ntp-server,192.168.0.2 #sets the NTP server to 192.168.0.2
dhcp-authoritative				#makes this the authoritative (in this case ONLY) DHCP server on the network
&nbsp;
# Server DNS settings... this is required as the server itself will
# not be obtaining it's IP address via DHCP and therefore would 
# not be automatically added to the DNS records for forward/reverse
# DNS queries as required by Kerberos
ptr-record=2.0.168.192.in-addr.arpa.,&quot;neo.danbishop.org&quot; 
address=/neo.danbishop.org/192.168.0.2 
&nbsp;
# Kerberos and LDAP automatic stuff...
# This maps kerberos.danbishop.org and
# ldap.danbishop.org to the server and also makes all
# dhcp clients aware of the kerberos realm... magic :D
address=/kerberos.danbishop.org/192.168.0.2 
address=/ldap.danbishop.org/192.168.0.2 
&nbsp;
txt-record=_kerberos.danbishop.org,&quot;DANBISHOP.ORG&quot;
srv-host=_kerberos._udp.danbishop.org,&quot;kerberos.danbishop.org&quot;,88
srv-host=_kerberos._tcp.danbishop.org,&quot;kerberos.danbishop.org&quot;,88
srv-host=_kerberos-master._udp.danbishop.org,&quot;kerberos.danbishop.org&quot;,88
srv-host=_kerberos-adm._tcp.danbishop.org,&quot;kerberos.danbishop.org&quot;,749
srv-host=_kpasswd._udp.danbishop.org,&quot;kerberos.danbishop.org&quot;,464
&nbsp;
srv-host=_ldap._tcp.danbishop.org,ldap.danbishop.org,389</pre></div></div>

<p>It is well worth reading through the entire configuration file though as there is a lot to be learnt from the excellent comments!</p>
<p>Dnsmasq is now configured to act as your network&#8217;s DHCP server and clients are told to use your server for DNS queries. Now you&#8217;re all set to get DNS and DHCP up and running. Simply restart the service to load the new configuration:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> service dnsmasq restart</pre></div></div>

<h2>References</h2>
<p><a href="https://help.ubuntu.com/community/Dnsmasq" onclick="pageTracker._trackPageview('/outgoing/help.ubuntu.com/community/Dnsmasq?referer=');">https://help.ubuntu.com/community/Dnsmasq</a></p>
 <p><a href="http://www.danbishop.org/?flattrss_redirect&amp;id=586&amp;md5=68d3eb8279d672e9290bc5686424a3a7" title="Flattr" target="_blank"><img src="http://www.danbishop.org/wp-content/plugins/flattr/img/flattr-badge-large.png" alt="flattr this!"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.danbishop.org/2011/10/29/ubuntu-11-10-sbs-small-business-server-setup-part-1-%e2%80%93-dhcp-and-dns/feed/</wfw:commentRss>
		<slash:comments>4</slash:comments>
		<atom:link rel="payment" href="http://www.danbishop.org/?flattrss_redirect&amp;id=586&amp;md5=68d3eb8279d672e9290bc5686424a3a7" type="text/html" />
	</item>
		<item>
		<title>How to mount SFTP/SSH shares in OS X Lion</title>
		<link>http://www.danbishop.org/2011/09/10/how-to-mount-sftpssh-shares-in-os-x-lion/</link>
		<comments>http://www.danbishop.org/2011/09/10/how-to-mount-sftpssh-shares-in-os-x-lion/#comments</comments>
		<pubDate>Sat, 10 Sep 2011 08:52:47 +0000</pubDate>
		<dc:creator>Dan Bishop</dc:creator>
				<category><![CDATA[Internet]]></category>
		<category><![CDATA[Software]]></category>
		<category><![CDATA[OS X]]></category>
		<category><![CDATA[sftp]]></category>
		<category><![CDATA[ssh]]></category>

		<guid isPermaLink="false">http://www.danbishop.org/?p=573</guid>
		<description><![CDATA[If you&#8217;d like to use an sftp share directly though finder then this guide is for you. First, you need to install OSXFuse from https://github.com/osxfuse/osxfuse/downloads At the &#8220;Installation Type&#8221; stage, be sure to select MacFUSE Compatibility Layer. It&#8217;s unticked by default. Once installed, you need to get Macfusion from http://macfusionapp.org/ Perform the usual drag and [...]]]></description>
			<content:encoded><![CDATA[<div class="alignleft"><div class="g-plusone" data-href="http://www.danbishop.org/2011/09/10/how-to-mount-sftpssh-shares-in-os-x-lion/" size="small" count="true"></div></div><p>If you&#8217;d like to use an sftp share directly though finder then this guide is for you.</p>
<p>First, you need to install OSXFuse from <a href="https://github.com/osxfuse/osxfuse/downloads" onclick="pageTracker._trackPageview('/outgoing/github.com/osxfuse/osxfuse/downloads?referer=');">https://github.com/osxfuse/osxfuse/downloads</a></p>
<p>At the &#8220;Installation Type&#8221; stage, be sure to select MacFUSE Compatibility Layer. It&#8217;s unticked by default.</p>
<p>Once installed, you need to get Macfusion from <a href="http://macfusionapp.org/" onclick="pageTracker._trackPageview('/outgoing/macfusionapp.org/?referer=');">http://macfusionapp.org/</a></p>
<p>Perform the usual drag and drop into your Applications folder then run Macfusion.</p>
<p>Add a new Macfusion share by clicking on the plus icon and selecting SSHFS, enter your details, click ok, then mount. After a few moments your share will be available. You can press cmd+r to show your share in the Finder.</p>
<p>You can now directly edit files on the sftp share using any app on your mac without the need to manually download and re-upload them.</p>
<p>If this process does not work for you, try restarting your mac, then re-adding the Macfusion share.</p>
 <p><a href="http://www.danbishop.org/?flattrss_redirect&amp;id=573&amp;md5=9f4b53e1f5cf5761bb3a0d7fcac92d98" title="Flattr" target="_blank"><img src="http://www.danbishop.org/wp-content/plugins/flattr/img/flattr-badge-large.png" alt="flattr this!"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.danbishop.org/2011/09/10/how-to-mount-sftpssh-shares-in-os-x-lion/feed/</wfw:commentRss>
		<slash:comments>7</slash:comments>
		<atom:link rel="payment" href="http://www.danbishop.org/?flattrss_redirect&amp;id=573&amp;md5=9f4b53e1f5cf5761bb3a0d7fcac92d98" type="text/html" />
	</item>
		<item>
		<title>How to Install Ubuntu from USB on Macbook Air 4,2 (2011)</title>
		<link>http://www.danbishop.org/2011/09/09/how-to-install-ubuntu-from-usb-on-macbook-air-42-2011/</link>
		<comments>http://www.danbishop.org/2011/09/09/how-to-install-ubuntu-from-usb-on-macbook-air-42-2011/#comments</comments>
		<pubDate>Fri, 09 Sep 2011 08:12:36 +0000</pubDate>
		<dc:creator>Dan Bishop</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.danbishop.org/?p=569</guid>
		<description><![CDATA[Create Ubuntu USB Stick First download an Ubuntu iso from www.ubuntu.com/download Be sure to get the 64bit+mac desktop version. The first step is to convert the iso to a dmg using the terminal: hdiutil convert -format UDRW -o ~/Downloads/ubuntu.dmg ~/Downloads/ubuntu-11.10-desktop-amd64+mac.iso Run the command &#8220;diskutil list&#8221; without your usb stick in, then again once the stick [...]]]></description>
			<content:encoded><![CDATA[<div class="alignleft"><div class="g-plusone" data-href="http://www.danbishop.org/2011/09/09/how-to-install-ubuntu-from-usb-on-macbook-air-42-2011/" size="small" count="true"></div></div><h2>Create Ubuntu USB Stick</h2>
<p>First download an Ubuntu iso from www.ubuntu.com/download</p>
<p>Be sure to get the 64bit+mac desktop version.</p>
<p>The first step is to convert the iso to a dmg using the terminal:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">hdiutil convert <span style="color: #660033;">-format</span> UDRW <span style="color: #660033;">-o</span> ~<span style="color: #000000; font-weight: bold;">/</span>Downloads<span style="color: #000000; font-weight: bold;">/</span>ubuntu.dmg ~<span style="color: #000000; font-weight: bold;">/</span>Downloads<span style="color: #000000; font-weight: bold;">/</span>ubuntu-<span style="color: #000000;">11.10</span>-desktop-amd64+mac.iso</pre></div></div>

<p>Run the command &#8220;diskutil list&#8221; without your usb stick in, then again once the stick has been inserted. The output from the second command should look something like:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">dan-macbookair:~ dan$ diskutil  list
/dev/disk0
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        *121.3 GB   disk0
   1:                        EFI                         209.7 MB   disk0s1
   2:                  Apple_HFS Macintosh HD            120.5 GB   disk0s2
   3:                 Apple_Boot Recovery HD             650.0 MB   disk0s3
/dev/disk1
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:     FDisk_partition_scheme                        *16.0 GB    disk1
   1:             Windows_FAT_32                         16.0 GB    disk1s1</pre></div></div>

<p>As you can see, disk1 has appeared since the insertion of the USB stick. It is very important you work out which disk your USB stick is in this way, else the next step will cause you to wipe out data on your Macbook Air&#8217;s SSD!</p>
<p>Now run:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">diskutil unmountDisk <span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>disk1</pre></div></div>

<p>Substituting disk1 for your USB stick&#8217;s disk number.</p>
<p>Next we&#8217;re going to write the image to the stick like so:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">dd</span> <span style="color: #007800;">if</span>=~<span style="color: #000000; font-weight: bold;">/</span>Downloads<span style="color: #000000; font-weight: bold;">/</span>ubuntu.dmg <span style="color: #007800;">of</span>=<span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>rdisk1 <span style="color: #007800;">bs</span>=1m</pre></div></div>

<p>Note that this time we&#8217;ve added an r to the front of disk1, this is not essential, but will speed up the process.</p>
<p>Finally, once the above command has executed, run &#8220;diskutil eject /dev/disk1&#8243; again replacing disk1 with your own stick&#8217;s reference.</p>
<p>Your USB stick has been created, restart your Macbook Air holding the alt key and choose to boot from the stick.</p>
<h2>Installation</h2>
<p>As soon as you see the purple screen with the white icon at the bottom, hit any key to get the USB stick&#8217;s boot menu. Select your language then press F6 and select the nomodeset option. Press ESC to return to the main menu and select &#8220;Try Ubuntu without any change to your computer&#8221;.</p>
<p>Proceed with the installation as normal, once finished, reboot the machine and hold down alt. Ubuntu will show up as &#8220;Windows&#8221;, select this option.</p>
<p>After a short pause you will see Grub and a list of boot options, press &#8220;e&#8221; to edit the default boot options. You will be presented with several strings of text, the penultimate line begins &#8220;Linux&#8230;&#8221; scroll along this line and add &#8220;nomodeset&#8221; directly before &#8220;quiet splash&#8221; so that it now reads &#8220;&#8230; nomodeset quiet splash &#8230;&#8221;.</p>
<p>Press ctrl+x to boot Ubuntu.</p>
<h2>Fixing things&#8230;<br />
<h2>
<p>First things first, install any updates that have come out since 11.10 was released:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">apt-get</span> update
<span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">apt-get</span> upgrade</pre></div></div>

<p>Now reboot. Yes, I know, how Windows-like&#8230; but we are about to start playing with your kernel and it&#8217;s a good idea to be using the new one you&#8217;ll have just installed through updates! Don&#8217;t forget to use the nomodeset trick from above again (don&#8217;t worry&#8230; this should be the last time!).</p>
<p>Now we&#8217;re going to run the incredible post-install-oneiric.sh script from almostsure.com:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">wget</span> http:<span style="color: #000000; font-weight: bold;">//</span>almostsure.com<span style="color: #000000; font-weight: bold;">/</span>mba42<span style="color: #000000; font-weight: bold;">/</span>post-install-oneiric.sh
<span style="color: #c20cb9; font-weight: bold;">chmod</span> +x post-install-oneiric.sh
.<span style="color: #000000; font-weight: bold;">/</span>post-install-oneiric.sh</pre></div></div>

 <p><a href="http://www.danbishop.org/?flattrss_redirect&amp;id=569&amp;md5=37d9f91b7f76c204ff892dfd65a122e2" title="Flattr" target="_blank"><img src="http://www.danbishop.org/wp-content/plugins/flattr/img/flattr-badge-large.png" alt="flattr this!"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.danbishop.org/2011/09/09/how-to-install-ubuntu-from-usb-on-macbook-air-42-2011/feed/</wfw:commentRss>
		<slash:comments>8</slash:comments>
		<atom:link rel="payment" href="http://www.danbishop.org/?flattrss_redirect&amp;id=569&amp;md5=37d9f91b7f76c204ff892dfd65a122e2" type="text/html" />
	</item>
		<item>
		<title>Ubuntu 11.04 SBS (Small Business Server) Setup: Part 8 – Connecting Mac OS X Clients to Your Ubuntu Server with Kerberos, LDAP and NFS Home Directories</title>
		<link>http://www.danbishop.org/2011/05/27/ubuntu-10-10-sbs-small-business-server-setup-part-8-%e2%80%93-adding-mac-os-x-clients-into-the-mix/</link>
		<comments>http://www.danbishop.org/2011/05/27/ubuntu-10-10-sbs-small-business-server-setup-part-8-%e2%80%93-adding-mac-os-x-clients-into-the-mix/#comments</comments>
		<pubDate>Fri, 27 May 2011 18:18:47 +0000</pubDate>
		<dc:creator>Dan Bishop</dc:creator>
				<category><![CDATA[Software]]></category>
		<category><![CDATA[OS X]]></category>

		<guid isPermaLink="false">http://www.danbishop.org/?p=423</guid>
		<description><![CDATA[Sadly, it&#8217;s inevitable (until the resolution of bug number 1) that many organisations will use software only available for platforms other than Ubuntu. This section of the guide is going to look at adding Macs to your network. Changes to the Server At present, Mac OS X (10.6 and below) does not support NFSv4. There [...]]]></description>
			<content:encoded><![CDATA[<div class="alignleft"><div class="g-plusone" data-href="http://www.danbishop.org/2011/05/27/ubuntu-10-10-sbs-small-business-server-setup-part-8-%e2%80%93-adding-mac-os-x-clients-into-the-mix/" size="small" count="true"></div></div><p>Sadly, it&#8217;s inevitable (until the resolution of <a href="https://bugs.launchpad.net/ubuntu/+bug/1" onclick="pageTracker._trackPageview('/outgoing/bugs.launchpad.net/ubuntu/+bug/1?referer=');">bug number 1</a>) that many organisations will use software only available for platforms other than Ubuntu. This section of the guide is going to look at adding Macs to your network.</p>
<h2>Changes to the Server</h2>
<p>At present, Mac OS X (10.6 and below) does not support NFSv4. There is alpha support, but only when mounting manually, not when using automount. In short, that means we need to make sure our server is capable of using NFSv3 alongside NFSv4.</p>
<p>If you&#8217;ve followed the rest of this guide to setup your server, there&#8217;s nothing to do here you can skip straight to configuring your mac! <img src='http://www.danbishop.org/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>If your /etc/exports file looks something like this:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;"># /etc/exports: the access control list for filesystems which may be exported
#		to NFS clients.  See exports(5).
#
# Example for NFSv2 and NFSv3:
# /srv/homes       hostname1(rw,sync,no_subtree_check) hostname2(ro,sync,no_subtree_check)
#
# Example for NFSv4:
# /srv/nfs4        gss/krb5i(rw,sync,fsid=0,crossmnt,no_subtree_check)
# /srv/nfs4/homes  gss/krb5i(rw,sync,no_subtree_check)
#
/export         gss/krb5(rw,fsid=0,async,subtree_check,no_root_squash,crossmnt)
/export/home   gss/krb5(rw,sync,no_subtree_check)</pre></div></div>

<p>Where the export lines contain gss/krb5(&#8230;.) then you need to change them. This is a deprecated way of exporting NFS shares, but unfortunately lots of other guides still use it. You need to change the above lines to look like so:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">/export *(rw,fsid=0,crossmnt,insecure,async,no_subtree_check,sec=krb5p:krb5i:krb5)
/export/home *(rw,insecure,async,no_subtree_check,sec=krb5p:krb5i:krb5)</pre></div></div>

<p>Note the insecure option. This is required for OS X to be able to connect. It&#8217;s not as bad as it sounds though! You&#8217;ll still be using Kerberos, so your system will still be secure, it just means that ports above 1024 can be used.  See this relevant snippet from &#8220;man mount_nfs&#8221; on OS X:</p>
<blockquote><p>resvport<br />
Use a reserved socket port number. This is useful for mounting<br />
servers that require clients to use a reserved port number on the<br />
mistaken belief that this makes NFS more secure. (For the rare<br />
case where the client has a trusted root account but untrustwor-<br />
thy users and the network cables are in secure areas this does<br />
help, but for normal desktop clients this does not apply.)</p></blockquote>
<p>All that remains to do on the server now, is restart NFS:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> service nfs-kernel-server restart</pre></div></div>

<h2>Configuring the Mac</h2>
<h3>Kerberos</h3>
<p>Open the terminal from finder at Applications/Utilities/Terminal and create a /Library/Preferences/edu.mit.Kerberos file as follows:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">nano</span> <span style="color: #000000; font-weight: bold;">/</span>Library<span style="color: #000000; font-weight: bold;">/</span>Preferences<span style="color: #000000; font-weight: bold;">/</span>edu.mit.Kerberos</pre></div></div>

<p>This file will be completely empty so we only need to add basic information like so:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">[libdefaults]
	default_realm = DANBISHOP.ORG
	dns_lookup_kdc = true
	forwardable = true
	noaddresses = true
	allow_weak_crypto = true
[realms]
	DANBISHOP.ORG = {
		kdc = neo.danbishop.org
		admin_server = neo.danbishop.org
	}</pre></div></div>

<p>Remembering of course to change the realm information to math your own!</p>
<p>Now we need to enable Kerberos authentication for login. This is done by modifying the /private/etc/authorization file.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">cp</span> <span style="color: #660033;">-p</span> <span style="color: #000000; font-weight: bold;">/</span>private<span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>authorization <span style="color: #000000; font-weight: bold;">/</span>private<span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>authorization_orig
<span style="color: #c20cb9; font-weight: bold;">sudo</span> pico <span style="color: #660033;">-w</span> <span style="color: #000000; font-weight: bold;">/</span>private<span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>authorization</pre></div></div>

<p>Press ctrl+W to begin a search, then enter system.login.console</p>
<p>You will get something like this depending on which version of OS X you are using:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">...
                &lt;key&gt;system.login.console&lt;/key&gt;
                &lt;dict&gt;
                        &lt;key&gt;class&lt;/key&gt;
                        &lt;string&gt;evaluate-mechanisms&lt;/string&gt;
                        &lt;key&gt;comment&lt;/key&gt;
                        &lt;string&gt;Login mechanism based rule.  Not for general us$
                        &lt;key&gt;mechanisms&lt;/key&gt;
                        &lt;array&gt;
                                &lt;string&gt;builtin:smartcard-sniffer,privileged&lt;/s$
                                &lt;string&gt;loginwindow:login&lt;/string&gt;
                                &lt;string&gt;builtin:reset-password,privileged&lt;/stri$
                                &lt;string&gt;builtin:auto-login,privileged&lt;/string&gt;
                                &lt;string&gt;builtin:authenticate,privileged&lt;/string&gt;
                                &lt;string&gt;loginwindow:success&lt;/string&gt;
                                &lt;string&gt;HomeDirMechanism:login,privileged&lt;/stri$
                                &lt;string&gt;HomeDirMechanism:status&lt;/string&gt;
                                &lt;string&gt;MCXMechanism:login&lt;/string&gt;
                                &lt;string&gt;loginwindow:done&lt;/string&gt;
                        &lt;/array&gt;
...</pre></div></div>

<p>For Tiger (Mac OS X 10.4.x), change:<br />
From:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">&lt;string&gt;authinternal&lt;/string&gt;</pre></div></div>

<p>To:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">&lt;string&gt;builtin:krb5authnoverify,privileged&lt;/string&gt;</pre></div></div>

<p>For Leopard (Mac OS X 10.5.x) or greater, change: </p>
<p>From:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">&lt;string&gt;builtin:authenticate,privileged&lt;/string&gt;</pre></div></div>

<p>To:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">&lt;string&gt;builtin:krb5authnoverify,privileged&lt;/string&gt;</pre></div></div>

<p>There may be multiple occurrences of &#8216;authinternal&#8217; or &#8216;authenticate&#8217; in the /etc/authorization file. Make sure you change the correct one!</p>
<p>Now we&#8217;re going to create a kerberos principal for NFS on the Mac and then add it to the Mac&#8217;s Kerberos keytab:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">kadmin <span style="color: #660033;">-p</span> dan<span style="color: #000000; font-weight: bold;">/</span>admin <span style="color: #660033;">-q</span> <span style="color: #ff0000;">&quot;addprinc -randkey nfs/dan-macmini.danbishop.org&quot;</span>
<span style="color: #c20cb9; font-weight: bold;">sudo</span> kadmin <span style="color: #660033;">-p</span> dan<span style="color: #000000; font-weight: bold;">/</span>admin <span style="color: #660033;">-q</span> <span style="color: #ff0000;">&quot;ktadd nfs/dan-desktop.danbishop.org&quot;</span></pre></div></div>

<h3>LDAP</h3>
<p>Now we need to configure OS X so that it knows how to find user details from our Ubuntu LDAP server. To do this we use the directory utility. In OS X Snow Leopard (10.6) this is found by going to System Preferences/Accounts/Login Options then clicking the join button by &#8220;Network Account Server:&#8221;. On the window that pops up, click &#8220;Open Directory Utility&#8221;.</p>
<p>Select LDAPv3 from the services list and click the edit icon (the pencil). Click show options and press the &#8220;New&#8221; button followed by the &#8220;Manual&#8221; button.</p>
<p>Now it&#8217;s time to enter the settings&#8230; you can set anything you like as the configuration name. For the server name enter the address of your LDAP server (&#8220;neo.danbishop.org&#8221; in my case). For LDAP Mappings you must select RFC 2307 (Unix). When you do this you will be prompted to enter the search base. This is your domain in ldap format&#8230; e.g. &#8220;dc=danbishop,dc=org&#8221;.</p>
<p>Leave SSL unticked (unless you know what you&#8217;re doing) and click OK.</p>
<p>Now we need to edit the search policy. Click the search policy button at the top of the Directory Utility and change the search dropdown from &#8220;Automatic&#8221; to &#8220;Custom Path&#8221;. Click on the + button that appears under the list of Directory Domains. You should see the domain we just setup listed as available. Click add, then apply. We&#8217;re done with the Directory Utility now <img src='http://www.danbishop.org/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<h3>NFS</h3>
<p>Try as I might, I cannot get the OS X automounter to work with this setup <img src='http://www.danbishop.org/wp-includes/images/smilies/icon_sad.gif' alt=':(' class='wp-smiley' />  Any suggestions would be VERY welcome!</p>
<p>Meanwhile, we can mount the entire /home directory at boot (though Kerberos will prevent unauthorised access!) by going to the Disk Utility (spotlight it if you can&#8217;t find it) then selecting File/NFS Mounts&#8230;</p>
<p>Click the plus icon and enter the following two settings:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">Remote NFS URL: nfs://neo.danbishop.org/export/home
Mount Location: /home</pre></div></div>

<p>Reboot the Mac and you&#8217;re done <img src='http://www.danbishop.org/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </p>
<p>You can read about my efforts so far with the automounter below:</p>
<h3>NFS and Automounts</h3>
<p><strong>PLEASE NOTE: THIS DOES NOT CURRENTLY WORK!</strong></p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">nano</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>auto_home</pre></div></div>


<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">#
# Automounter map for /home
#
#+auto_home     # Use directory service</pre></div></div>


<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">#
# Automounter map for /home
#
#+auto_home     # Use directory service
*   -fstype=nfs,sec=krb5   neo.danbishop.org:/export/home/&amp;</pre></div></div>

<p>Restart the Mac and you&#8217;re good to go! <img src='http://www.danbishop.org/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<h2>References</h2>
<p><a href="http://clc.its.psu.edu/UnivServices/itadmins/mac/kerbldaplogins" onclick="pageTracker._trackPageview('/outgoing/clc.its.psu.edu/UnivServices/itadmins/mac/kerbldaplogins?referer=');">http://clc.its.psu.edu/UnivServices/itadmins/mac/kerbldaplogins</a><br />
h<a href="http://krypted.com/mac-os-x-server/nfs-ubuntu-mac-os-x-clients-a-quickie/" onclick="pageTracker._trackPageview('/outgoing/krypted.com/mac-os-x-server/nfs-ubuntu-mac-os-x-clients-a-quickie/?referer=');">ttp://krypted.com/mac-os-x-server/nfs-ubuntu-mac-os-x-clients-a-quickie/</a></p>
 <p><a href="http://www.danbishop.org/?flattrss_redirect&amp;id=423&amp;md5=75c54460c305d0355f0d1ac37e06c898" title="Flattr" target="_blank"><img src="http://www.danbishop.org/wp-content/plugins/flattr/img/flattr-badge-large.png" alt="flattr this!"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.danbishop.org/2011/05/27/ubuntu-10-10-sbs-small-business-server-setup-part-8-%e2%80%93-adding-mac-os-x-clients-into-the-mix/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		<atom:link rel="payment" href="http://www.danbishop.org/?flattrss_redirect&amp;id=423&amp;md5=75c54460c305d0355f0d1ac37e06c898" type="text/html" />
	</item>
		<item>
		<title>Make Windows the Default Operating System in Grub2&#8230; even after Ubuntu updates&#8230;</title>
		<link>http://www.danbishop.org/2011/05/26/make-windows-the-default-operating-system-in-grub2-even-after-ubuntu-updates/</link>
		<comments>http://www.danbishop.org/2011/05/26/make-windows-the-default-operating-system-in-grub2-even-after-ubuntu-updates/#comments</comments>
		<pubDate>Thu, 26 May 2011 09:06:58 +0000</pubDate>
		<dc:creator>Dan Bishop</dc:creator>
				<category><![CDATA[Software]]></category>
		<category><![CDATA[grub2]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[windows]]></category>

		<guid isPermaLink="false">http://www.danbishop.org/?p=560</guid>
		<description><![CDATA[Many guides for changing the default operating system for Grub2 to boot involve setting the number indicating where in the list that OS appears&#8230; unfortunately, when kernel updates are released for Ubuntu they shift everything down two places and your default OS therefore changes. Fortunately, it is possible to set the default by name First [...]]]></description>
			<content:encoded><![CDATA[<div class="alignleft"><div class="g-plusone" data-href="http://www.danbishop.org/2011/05/26/make-windows-the-default-operating-system-in-grub2-even-after-ubuntu-updates/" size="small" count="true"></div></div><p>Many guides for changing the default operating system for Grub2 to boot involve setting the number indicating where in the list that OS appears&#8230; unfortunately, when kernel updates are released for Ubuntu they shift everything down two places and your default OS therefore changes.</p>
<p>Fortunately, it is possible to set the default by name <img src='http://www.danbishop.org/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>First we need to obtain the exact name of the OS you wish to boot by running the following command:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">fgrep</span> menuentry <span style="color: #000000; font-weight: bold;">/</span>boot<span style="color: #000000; font-weight: bold;">/</span>grub<span style="color: #000000; font-weight: bold;">/</span>grub.cfg</pre></div></div>

<p>You&#8217;ll get something like this:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">menuentry <span style="color: #ff0000;">'Ubuntu, with Linux 2.6.38-8-generic'</span> <span style="color: #660033;">--class</span> ubuntu <span style="color: #660033;">--class</span> gnu-linux <span style="color: #660033;">--class</span> gnu <span style="color: #660033;">--class</span> os <span style="color: #7a0874; font-weight: bold;">&#123;</span>
menuentry <span style="color: #ff0000;">'Ubuntu, with Linux 2.6.38-8-generic (recovery mode)'</span> <span style="color: #660033;">--class</span> ubuntu <span style="color: #660033;">--class</span> gnu-linux <span style="color: #660033;">--class</span> gnu <span style="color: #660033;">--class</span> os <span style="color: #7a0874; font-weight: bold;">&#123;</span>
menuentry <span style="color: #ff0000;">&quot;Memory test (memtest86+)&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span>
menuentry <span style="color: #ff0000;">&quot;Memory test (memtest86+, serial console 115200)&quot;</span> <span style="color: #7a0874; font-weight: bold;">&#123;</span>
menuentry <span style="color: #ff0000;">&quot;Mac OS X (32-bit) (on /dev/sda2)&quot;</span> <span style="color: #660033;">--class</span> osx <span style="color: #660033;">--class</span> darwin <span style="color: #660033;">--class</span> os <span style="color: #7a0874; font-weight: bold;">&#123;</span>
menuentry <span style="color: #ff0000;">&quot;Mac OS X (64-bit) (on /dev/sda2)&quot;</span> <span style="color: #660033;">--class</span> osx <span style="color: #660033;">--class</span> darwin <span style="color: #660033;">--class</span> os <span style="color: #7a0874; font-weight: bold;">&#123;</span>
menuentry “Windows Vista <span style="color: #7a0874; font-weight: bold;">&#40;</span>loader<span style="color: #7a0874; font-weight: bold;">&#41;</span> <span style="color: #7a0874; font-weight: bold;">&#40;</span>on <span style="color: #000000; font-weight: bold;">/</span>dev<span style="color: #000000; font-weight: bold;">/</span>sda1<span style="color: #7a0874; font-weight: bold;">&#41;</span>” <span style="color: #7a0874; font-weight: bold;">&#123;</span></pre></div></div>

<p>Now edit /etc/default/grub:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">nano</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>default<span style="color: #000000; font-weight: bold;">/</span>grub</pre></div></div>

<p>The default file looks like this:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;"># If you change this file, run 'update-grub' afterwards to update
# /boot/grub/grub.cfg.
# For full documentation of the options in this file, see:
#   info -f grub -n 'Simple configuration'
&nbsp;
GRUB_DEFAULT=0
#GRUB_HIDDEN_TIMEOUT=0
GRUB_HIDDEN_TIMEOUT_QUIET=true
GRUB_TIMEOUT=10
GRUB_DISTRIBUTOR=`lsb_release -i -s 2&gt; /dev/null || echo Debian`
GRUB_CMDLINE_LINUX_DEFAULT=&quot;quiet splash&quot;
GRUB_CMDLINE_LINUX=&quot;&quot;
&nbsp;
# Uncomment to enable BadRAM filtering, modify to suit your needs
# This works with Linux (no patch required) and with any kernel that obtains
# the memory map information from GRUB (GNU Mach, kernel of FreeBSD ...)
#GRUB_BADRAM=&quot;0x01234567,0xfefefefe,0x89abcdef,0xefefefef&quot;
&nbsp;
# Uncomment to disable graphical terminal (grub-pc only)
#GRUB_TERMINAL=console
&nbsp;
# The resolution used on graphical terminal
# note that you can use only modes which your graphic card supports via VBE
# you can see them in real GRUB with the command `vbeinfo'
#GRUB_GFXMODE=640x480
&nbsp;
&nbsp;
# Uncomment if you don't want GRUB to pass &quot;root=UUID=xxx&quot; parameter to Linux
#GRUB_DISABLE_LINUX_UUID=true
&nbsp;
# Uncomment to disable generation of recovery mode menu entries
#GRUB_DISABLE_RECOVERY=&quot;true&quot;
&nbsp;
# Uncomment to get a beep at grub start
#GRUB_INIT_TUNE=&quot;480 440 1&quot;</pre></div></div>

<p>In order to set Windows Vista to be the default (I know, I know&#8230; who in their right mind?!&#8230; but still&#8230;) you need to change the line that reads GRUB_DEFAULT=0 to be like so:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">GRUB_DEFAULT=”Windows Vista (loader) (on /dev/sda1)”</pre></div></div>

<p>Basically copying and pasting everything in quotes (including the quotes!) for the entry you want to be the default.</p>
<p>The final step is to exit and save, then update grub with:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> update-grub</pre></div></div>

 <p><a href="http://www.danbishop.org/?flattrss_redirect&amp;id=560&amp;md5=df60c1055f588bccfeac9fcef9a3fb02" title="Flattr" target="_blank"><img src="http://www.danbishop.org/wp-content/plugins/flattr/img/flattr-badge-large.png" alt="flattr this!"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.danbishop.org/2011/05/26/make-windows-the-default-operating-system-in-grub2-even-after-ubuntu-updates/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		<atom:link rel="payment" href="http://www.danbishop.org/?flattrss_redirect&amp;id=560&amp;md5=df60c1055f588bccfeac9fcef9a3fb02" type="text/html" />
	</item>
		<item>
		<title>Ubuntu 11.04 SBS (Small Business Server) Setup: Part 7 – Setting Up Clients</title>
		<link>http://www.danbishop.org/2011/05/01/ubuntu-11-04-sbs-small-business-server-setup-part-7-%e2%80%93-setting-up-clients/</link>
		<comments>http://www.danbishop.org/2011/05/01/ubuntu-11-04-sbs-small-business-server-setup-part-7-%e2%80%93-setting-up-clients/#comments</comments>
		<pubDate>Sun, 01 May 2011 16:58:25 +0000</pubDate>
		<dc:creator>Dan Bishop</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.danbishop.org/?p=500</guid>
		<description><![CDATA[This is part of a guide to setting up Ubuntu Server Edition 11.04 for a small/medium business. The server will provide DHCP, DNS, NTP, LDAP, Kerberos and NFS services such that users can login to any machine on the network and all their files and settings will be the same across the entire network. Part [...]]]></description>
			<content:encoded><![CDATA[<div class="alignleft"><div class="g-plusone" data-href="http://www.danbishop.org/2011/05/01/ubuntu-11-04-sbs-small-business-server-setup-part-7-%e2%80%93-setting-up-clients/" size="small" count="true"></div></div><p>This is part of a guide to setting up Ubuntu Server Edition 11.04 for a small/medium business. The server will provide DHCP, DNS, NTP, LDAP, Kerberos and NFS services such that users can login to any machine on the network and all their files and settings will be the same across the entire network.</p>
<ul>
<ol><a href="http://www.danbishop.org/?p=483">Part 1 &#8211; DHCP and DNS</ol>
<ol><a href="http://www.danbishop.org/?p=487">Part 2 &#8211; NTP</a></ol>
<ol><a href="http://www.danbishop.org/?p=492">Part 3 &#8211; OpenLDAP</a></ol>
<ol><a href="http://www.danbishop.org/?p=494">Part 4 &#8211; Kerberos</a></ol>
<ol><a href="http://www.danbishop.org/?p=496">Part 5 &#8211; NFS</a></ol>
<ol><a href="http://www.danbishop.org/?p=498">Part 6 &#8211; Account Management</a></ol>
<ol><a href="http://www.danbishop.org/?p=500">Part 7 &#8211; Setting Up Clients</a></ol>
</ul>
<p>The clients are going to be configured so that they mount home directories from the server and verify usernames/password using ldap and kerberos.<span id="more-500"></span></p>
<p>I will not cover installing Ubuntu Desktop on the client as there are hundreds of guides for this already, however, whilst installing I recommend you create a local user named &#8220;localadmin&#8221;. We will use this account to configure the client.</p>
<p>First we need to install some packages:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">apt-get</span> <span style="color: #c20cb9; font-weight: bold;">install</span> krb5-user libpam-krb5 libnss-ldapd nfs-common</pre></div></div>

<p>If you&#8217;ve been following this guide from the beginning, you may not be prompted for some of the following information as it is provided by your DHCP server as configured earlier.</p>
<p>If asked to enter your default Kerberos Version 5 realm enter: &#8220;DANBISHOP.ORG&#8221;</p>
<p>You might then be asked for the address of the kerberos server: &#8220;neo.danbishop.org&#8221;</p>
<p>The address of the administrative server: &#8220;neo.danbishop.org&#8221;</p>
<p>The address of your ldap server: &#8220;ldap://neo.danbishop.org/&#8221;</p>
<p>LDAP server search base: &#8220;dc=danbishop,dc=org&#8221;</p>
<p>Finally, name services to configure. Make sure you select group, passwd and shadow!</p>
<p>Run</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> pam-auth-update</pre></div></div>

<p>And ensure that LDAP and Kerberos are selected.</p>
<p>Now to configure idmapd so that the client correctly maps user and group names to ids, to do this you simply need to change the domain to match your own in /etc/idmapd.conf like so:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">nano</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>idmapd.conf</pre></div></div>


<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">[General]
&nbsp;
Verbosity = 0
Pipefs-Directory = /var/lib/nfs/rpc_pipefs
Domain = danbishop.org
&nbsp;
[Mapping]
&nbsp;
Nobody-User = nobody
Nobody-Group = nogroup</pre></div></div>

<p>Now for the home directories&#8230;</p>
<p>Although we have configured everything so that clients can get kerberos settings from DNS&#8230; kadmin does not fully support this <img src='http://www.danbishop.org/wp-includes/images/smilies/icon_sad.gif' alt=':(' class='wp-smiley' /> </p>
<p>This means we&#8217;re going to have to make a small change to /etc/krb5.conf on the clients to make the following steps a LOT easier.</p>
<p>Add the following to the [realms] section of /etc/krb5.conf:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">[realms]
         DANBISHOP.ORG = {
             kdc = neo.danbishop.org
             admin_server = neo.danbishop.org
             master_kdc = neo.danbishop.org
             default_domain = danbishop.org
         }</pre></div></div>

<p>Now we&#8217;re going to create a kerberos principal for NFS on the client like so:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">kadmin <span style="color: #660033;">-p</span> dan<span style="color: #000000; font-weight: bold;">/</span>admin <span style="color: #660033;">-q</span> <span style="color: #ff0000;">&quot;addprinc -randkey nfs/dan-desktop.danbishop.org&quot;</span></pre></div></div>

<p>Having specified the admin server in /etc/krb5.conf we can run these command directly from the client.</p>
<p>Now we need to add the principal that&#8217;s just been created on the server, to the keytab file on the client:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> kadmin <span style="color: #660033;">-p</span> dan<span style="color: #000000; font-weight: bold;">/</span>admin <span style="color: #660033;">-q</span> <span style="color: #ff0000;">&quot;ktadd nfs/dan-desktop.danbishop.org&quot;</span></pre></div></div>

<p>Sadly, there is one final change that needs to be made to /etc/krb5.conf. We need to allow weak encryption for Kerberos in order for NFS to work. This should soon be fixed (11.04?) and if you&#8217;re interested in why this is the case there are numerous bug reports on launchpad. For now though add the following to the [libdefaults] section of /etc/krb5.conf:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">allow_weak_crypto = true</pre></div></div>

<h2>Configuring NFS</h2>
<p>NFS needs to be configured to use kerberos by editing /etc/default/nfs-common:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;"># If you do not set values for the NEED_ options, they will be attempted
# autodetected; this should be sufficient for most people. Valid alternatives
# for the NEED_ options are &quot;yes&quot; and &quot;no&quot;.
&nbsp;
# Do you want to start the statd daemon? It is not needed for NFSv4.
NEED_STATD=
&nbsp;
# Options for rpc.statd.
#   Should rpc.statd listen on a specific port? This is especially useful
#   when you have a port-based firewall. To use a fixed port, set this
#   this variable to a statd argument like: &quot;--port 4000 --outgoing-port 4001&quot;.
#   For more information, see rpc.statd(8) or http://wiki.debian.org/?SecuringNFS
STATDOPTS=
&nbsp;
# Do you want to start the idmapd daemon? It is only needed for NFSv4.
NEED_IDMAPD=yes
&nbsp;
# Do you want to start the gssd daemon? It is required for Kerberos mounts.
NEED_GSSD=yes</pre></div></div>

<p>Note that NEED_IDMAPD and NEED_GSSD have been set to yes.</p>
<h2>AutoFS</h2>
<p>Now we&#8217;re going to install and configure autofs to mount home directories on login.</p>
<p>Install the autofs package:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">apt-get</span> <span style="color: #c20cb9; font-weight: bold;">install</span> autofs</pre></div></div>

<p>To configure autofs we will edit /etc/auto.master.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">nano</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>auto.master</pre></div></div>

<p>Here is the sample file provided by Ubuntu:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">#
# Sample auto.master file
# This is an automounter map and it has the following format
# key [ -mount-options-separated-by-comma ] location
# For details of the format look at autofs(5).
#
#/misc  /etc/auto.misc
#
# NOTE: mounts done from a hosts map will be mounted with the
#       &quot;nosuid&quot; and &quot;nodev&quot; options unless the &quot;suid&quot; and &quot;dev&quot;
#       options are explicitly given.
#
#/net   -hosts
#
# Include central master map if it can be found using
# nsswitch sources.
#
# Note that if there are entries for /net or /misc (as
# above) in the included master map any keys that are the
# same will not be seen as the first read key seen takes
# precedence.
#
+auto.master</pre></div></div>

<p>As you can see, everything except the last line is commented out. COMMENT OUT THE LAST LINE. Then take note of the format used by the examples. Each mount point is associated with another configuration file. We will create a new configuration file for our NFS share(s).</p>
<p>Add the following line at the end of /etc/auto.master:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">/home   /etc/auto.home</pre></div></div>

<p>This creates a mount point at /home and configures it according to the settings specified in /etc/auto.home (which we are about to create).</p>
<p>Now we will create the file which countains our automounter map:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">nano</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>auto.home</pre></div></div>

<p>This file should contain a separate line for each NFS share. The format for a line is {mount point} [{mount options}] {location}.</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">*   -fstype=nfs4,rw,soft,sec=krb5   neo.danbishop.org:/home/&amp;</pre></div></div>

<p>This will automount any directory you try to access in /home allowing any user to login <img src='http://www.danbishop.org/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>All that remains is to restart automount (personally I&#8217;d just reboot the machine) by running:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> service autofs restart</pre></div></div>

<p>Finally, we want the local machine to use LDAP groups and users over local ones so that domain administrators will have admin access to every machine on the network. This is done by editing /etc/nsswtich.conf</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">nano</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>nsswitch.conf</pre></div></div>

<p>By default the file looks like so:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;"># /etc/nsswitch.conf
#
# Example configuration of GNU Name Service Switch functionality.
# If you have the `glibc-doc-reference' and `info' packages installed, try:
# `info libc &quot;Name Service Switch&quot;' for information about this file.
&nbsp;
passwd:         compat ldap
group:          compat ldap
shadow:         compat ldap
&nbsp;
hosts:          files dns
networks:       files
&nbsp;
protocols:      db files
services:       db files
ethers:         db files
rpc:            db files
&nbsp;
netgroup:       nis</pre></div></div>

<p>We want to change passwd, group and shadow to use LDAP first:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">passwd:         ldap files
group:          ldap files
shadow:         ldap files</pre></div></div>

<p>Now restart the client machine and you&#8217;re done! <img src='http://www.danbishop.org/wp-includes/images/smilies/icon_biggrin.gif' alt=':D' class='wp-smiley' /> </p>
 <p><a href="http://www.danbishop.org/?flattrss_redirect&amp;id=500&amp;md5=5e0d95c9f68e748188276032f5ac8701" title="Flattr" target="_blank"><img src="http://www.danbishop.org/wp-content/plugins/flattr/img/flattr-badge-large.png" alt="flattr this!"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.danbishop.org/2011/05/01/ubuntu-11-04-sbs-small-business-server-setup-part-7-%e2%80%93-setting-up-clients/feed/</wfw:commentRss>
		<slash:comments>9</slash:comments>
		<atom:link rel="payment" href="http://www.danbishop.org/?flattrss_redirect&amp;id=500&amp;md5=5e0d95c9f68e748188276032f5ac8701" type="text/html" />
	</item>
		<item>
		<title>Ubuntu 11.04 SBS (Small Business Server) Setup: Part 6 – Account Management</title>
		<link>http://www.danbishop.org/2011/05/01/ubuntu-11-04-sbs-small-business-server-setup-part-6-%e2%80%93-account-management/</link>
		<comments>http://www.danbishop.org/2011/05/01/ubuntu-11-04-sbs-small-business-server-setup-part-6-%e2%80%93-account-management/#comments</comments>
		<pubDate>Sun, 01 May 2011 16:36:33 +0000</pubDate>
		<dc:creator>Dan Bishop</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.danbishop.org/?p=498</guid>
		<description><![CDATA[This is part of a guide to setting up Ubuntu Server Edition 11.04 for a small/medium business. The server will provide DHCP, DNS, NTP, LDAP, Kerberos and NFS services such that users can login to any machine on the network and all their files and settings will be the same across the entire network. Part [...]]]></description>
			<content:encoded><![CDATA[<div class="alignleft"><div class="g-plusone" data-href="http://www.danbishop.org/2011/05/01/ubuntu-11-04-sbs-small-business-server-setup-part-6-%e2%80%93-account-management/" size="small" count="true"></div></div><p>This is part of a guide to setting up Ubuntu Server Edition 11.04 for a small/medium business. The server will provide DHCP, DNS, NTP, LDAP, Kerberos and NFS services such that users can login to any machine on the network and all their files and settings will be the same across the entire network.</p>
<ul>
<ol><a href="http://www.danbishop.org/?p=483">Part 1 &#8211; DHCP and DNS</ol>
<ol><a href="http://www.danbishop.org/?p=487">Part 2 &#8211; NTP</a></ol>
<ol><a href="http://www.danbishop.org/?p=492">Part 3 &#8211; OpenLDAP</a></ol>
<ol><a href="http://www.danbishop.org/?p=494">Part 4 &#8211; Kerberos</a></ol>
<ol><a href="http://www.danbishop.org/?p=496">Part 5 &#8211; NFS</a></ol>
<ol><a href="http://www.danbishop.org/?p=498">Part 6 &#8211; Account Management</a></ol>
<ol><a href="http://www.danbishop.org/?p=500">Part 7 &#8211; Setting Up Clients</a></ol>
</ul>
<p>Now you have OpenLDAP and Kerberos up and running, it&#8217;s time to learn how to manage your users and groups.<span id="more-498"></span></p>
<h2>Management Scripts Configuration</h2>
<p>Firstly, we&#8217;re going to install some scripts to aid with basic management tasks:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">apt-get</span> <span style="color: #c20cb9; font-weight: bold;">install</span> ldapscripts</pre></div></div>

<p>Now we need to edit the config file /etc/ldapscripts/ldapscripts.conf uncommenting and changing the following to match your environment:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">#  Copyright (C) 2005 Ganal LAPLANCHE - Linagora
#
#  This program is free software; you can redistribute it and/or
#  modify it under the terms of the GNU General Public License
#  as published by the Free Software Foundation; either version 2
#  of the License, or (at your option) any later version.
#
#  This program is distributed in the hope that it will be useful,
#  but WITHOUT ANY WARRANTY; without even the implied warranty of
#  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#  GNU General Public License for more details.
#
#  You should have received a copy of the GNU General Public License
#  along with this program; if not, write to the Free Software
#  Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307,
#  USA.
&nbsp;
# Note for Debian users:
# On Debian system ldapscripts will try to parse and use some system config.
# Look on commented variables and description lines started with DEBIAN.
# But you could override it's values here.
&nbsp;
&nbsp;
# LDAP Configuration
# DEBIAN: values from /etc/pam_ldap.conf are used.
SERVER=&quot;ldap://localhost&quot;
BINDDN=&quot;cn=admin,dc=danbishop,dc=org&quot;
&nbsp;
# The following file contains the raw password of the binddn
# Create it with something like : echo -n 'secret' &gt; $BINDPWDFILE
# WARNING !!!! Be careful not to make this file world-readable
# DEBIAN: /etc/pam_ldap.secret or /etc/ldap.secret are used.
#BINDPWDFILE=&quot;/etc/ldapscripts/ldapscripts.passwd&quot;
# For older versions of OpenLDAP, it is still possible to use
# unsecure command-line passwords by defining the following option
# AND commenting the previous one (BINDPWDFILE takes precedence)
#BINDPWD=&quot;secret&quot;
&nbsp;
# DEBIAN: values from /etc/pam_ldap.conf are used.
SUFFIX=&quot;dc=danbishop,dc=org&quot; # Global suffix
GSUFFIX=&quot;ou=Groups&quot;        # Groups ou (just under $SUFFIX)
USUFFIX=&quot;ou=Users&quot;         # Users ou (just under $SUFFIX)
MSUFFIX=&quot;ou=Machines&quot;      # Machines ou (just under $SUFFIX)
&nbsp;
# Start with these IDs *if no entry found in LDAP*
GIDSTART=&quot;10000&quot; # Group ID
UIDSTART=&quot;10000&quot; # User ID
MIDSTART=&quot;20000&quot; # Machine ID
&nbsp;
# User properties
# DEBIAN: values from /etc/adduser.conf are used.
#USHELL=&quot;/bin/sh&quot;
#UHOMES=&quot;/home/%u&quot;     # You may use %u for username here
CREATEHOMES=&quot;yes&quot;      # Create home directories and set rights ?
#HOMESKEL=&quot;/etc/skel&quot;  # Directory where the skeleton files are located. Ignored if undefined or nonexistant.
#HOMEPERMS=&quot;755&quot;       # Default permissions for home directories
&nbsp;
# User passwords generation
# Command-line used to generate a password for added users (you may use %u for username here)
# WARNING !!!! This is evaluated, everything specified here will be run !
# Special value &quot;&lt;ask&gt;&quot; will ask for a password interactively
#PASSWORDGEN=&quot;cat /dev/random | LC_ALL=C tr -dc 'a-zA-Z0-9' | head -c8&quot;
#PASSWORDGEN=&quot;head -c8 /dev/random | uuencode -m - | sed -n '2s|=*$||;2p' | sed -e 's|+||g' -e 's|/||g'&quot;
PASSWORDGEN=&quot;pwgen -s&quot;
#PASSWORDGEN=&quot;echo changeme&quot;
#PASSWORDGEN=&quot;echo %u&quot;
#PASSWORDGEN=&quot;&lt;ask&gt;&quot;
&nbsp;
# User passwords recording
# you can keep trace of generated passwords setting PASSWORDFILE and RECORDPASSWORDS
# (useful when performing a massive creation / net rpc vampire)
# WARNING !!!! DO NOT FORGET TO DELETE THE GENERATED FILE WHEN DONE !
# WARNING !!!! DO NOT FORGET TO TURN OFF RECORDING WHEN DONE !
RECORDPASSWORDS=&quot;no&quot;
PASSWORDFILE=&quot;/var/log/ldapscripts_passwd.log&quot;
&nbsp;
# Where to log
LOGFILE=&quot;/var/log/ldapscripts.log&quot;
&nbsp;
# Temporary folder
TMPDIR=&quot;/tmp&quot;
&nbsp;
# Various binaries used within the scripts
# Warning : they also use uuencode, date, grep, sed, cut, expr, which... 
# Please check they are installed before using these scripts
# Note that many of them should come with your OS
&nbsp;
# OpenLDAP client commands
LDAPSEARCHBIN=&quot;/usr/bin/ldapsearch&quot;
LDAPADDBIN=&quot;/usr/bin/ldapadd&quot;
LDAPDELETEBIN=&quot;/usr/bin/ldapdelete&quot;
LDAPMODIFYBIN=&quot;/usr/bin/ldapmodify&quot;
LDAPMODRDNBIN=&quot;/usr/bin/ldapmodrdn&quot;
LDAPPASSWDBIN=&quot;/usr/bin/ldappasswd&quot;
&nbsp;
# Character set conversion : $ICONVCHAR &lt;-&gt; UTF-8
# Comment ICONVBIN to disable UTF-8 conversion
#ICONVBIN=&quot;/usr/bin/iconv&quot;
#ICONVCHAR=&quot;ISO-8859-15&quot;
&nbsp;
# Base64 decoding
# Comment UUDECODEBIN to disable Base64 decoding
#UUDECODEBIN=&quot;/usr/bin/uudecode&quot;
&nbsp;
# Getent command to use - choose the ones used
# on your system. Leave blank or comment for auto-guess.
# GNU/Linux
#GETENTPWCMD=&quot;getent passwd&quot;
#GETENTGRCMD=&quot;getent group&quot;
# FreeBSD
#GETENTPWCMD=&quot;pw usershow&quot;
#GETENTGRCMD=&quot;pw groupshow&quot;
# Auto
GETENTPWCMD=&quot;&quot;
GETENTGRCMD=&quot;&quot;
&nbsp;
# You can specify custom LDIF templates here
# Leave empty to use default templates
# See *.template.sample for default templates
#GTEMPLATE=&quot;/path/to/ldapaddgroup.template&quot;
#UTEMPLATE=&quot;/path/to/ldapadduser.template&quot;
#MTEMPLATE=&quot;/path/to/ldapaddmachine.template&quot;
GTEMPLATE=&quot;&quot;
UTEMPLATE=&quot;&quot;
MTEMPLATE=&quot;&quot;</pre></div></div>

<p>The changes from the default file are highlighted below:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;"># Provides LDAP server's address and the admin username
SERVER=&quot;ldap://localhost&quot;
BINDDN=&quot;cn=admin,dc=danbishop,dc=org&quot;
&nbsp;
# These have all been uncommented, Users changed to People
# and the correct suffix set for our domain
SUFFIX=&quot;dc=danbishop,dc=org&quot; # Global suffix
GSUFFIX=&quot;ou=Groups&quot;        # Groups ou (just under $SUFFIX)
USUFFIX=&quot;ou=Users&quot;         # Users ou (just under $SUFFIX)
MSUFFIX=&quot;ou=Machines&quot;      # Machines ou (just under $SUFFIX)
&nbsp;
# This creates home directories when we create users
CREATEHOMES=&quot;yes&quot;</pre></div></div>

<p>If you&#8217;ve read through the default comments in /etc/ldapscripts/ldapscripts.conf you&#8217;ll see that it finds the LDAP admin password from a /etc/ldap.secret file. So the following two commands create that file, write our admin password to it (change PASSWORD to your admin password) and then set it to be non-world-readable. This prevents users discovering your LDAP password, but allows root, or processes running as root, to read the file and find the password.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">sh</span> <span style="color: #660033;">-c</span> <span style="color: #ff0000;">&quot;echo -n 'PASSWORD' &gt; /etc/ldap.secret&quot;</span>
<span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">chmod</span> <span style="color: #000000;">400</span> <span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>ldap.secret</pre></div></div>

<p>You might also have noticed that /etc/adduser.conf is used to determine home directory defaults. Ubuntu allows users to view the contents of other user&#8217;s home directories by default. In some environments, particularly home environments, this is fine, but you might want to change that by editing DIR_MODE=0755 to be DIR_MODE=0700.</p>
<h2>Managing Users</h2>
<p>Now the LDAP scripts are configured we can start creating users. We&#8217;re going to use the group name &#8220;admin&#8221; for administrators as this is the default for Ubuntu and will enable us to give admin rights to users on every machine on the network without any further configuration. However, as this group already exists as a local group, we need to be very careful that we don&#8217;t lock ourselves out of the server here&#8230;</p>
<p>The first thing to do is create a password for our first admin user. As we are using Kerberos for authentication, the administrator needs a principal creating. This is done like so:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> kadmin.local <span style="color: #660033;">-q</span> <span style="color: #ff0000;">&quot;addprinc dan&quot;</span></pre></div></div>

<p>Now we need some groups to hold our users. The first two groups we will create will be &#8220;admin&#8221; and &#8220;user&#8221;:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> ldapaddgroup admin
<span style="color: #c20cb9; font-weight: bold;">sudo</span> ldapaddgroup user</pre></div></div>

<p>Next we will create a user and assign him to a group:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> ldapadduser dan <span style="color: #000000;">10001</span></pre></div></div>

<p>Note the use of group 10001 rather than simply &#8220;admin&#8221;. This is to avoid any confusion with the local admin group on the server. In some instances, I&#8217;ve seen this cause issues. Group 10001 will be the first ldap group you created, you can see the GIDs for all groups by using the command &#8220;getent group&#8221;.</p>
<p>And finally add the user to the user group:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> ldapaddusertogroup dan <span style="color: #000000;">10002</span></pre></div></div>

<p>You can now login to the server (and later client machines) as this user. The &#8220;localadmin&#8221; account on the server will no longer be able to use sudo as it doesn&#8217;t belong to the ldap &#8220;admin&#8221; group, only the local one. For subsequent users, you may create the Kerberos principal after creating the LDAP user if you prefer.</p>
<h2>References</h2>
<p><a href="http://www.opinsys.fi/en/setting-up-openldap-on-ubuntu-10-04-alpha2" onclick="pageTracker._trackPageview('/outgoing/www.opinsys.fi/en/setting-up-openldap-on-ubuntu-10-04-alpha2?referer=');">http://www.opinsys.fi/en/setting-up-openldap-on-ubuntu-10-04-alpha2</a></p>
 <p><a href="http://www.danbishop.org/?flattrss_redirect&amp;id=498&amp;md5=f050e3b86c834cb553ed832beaf0778b" title="Flattr" target="_blank"><img src="http://www.danbishop.org/wp-content/plugins/flattr/img/flattr-badge-large.png" alt="flattr this!"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.danbishop.org/2011/05/01/ubuntu-11-04-sbs-small-business-server-setup-part-6-%e2%80%93-account-management/feed/</wfw:commentRss>
		<slash:comments>14</slash:comments>
		<atom:link rel="payment" href="http://www.danbishop.org/?flattrss_redirect&amp;id=498&amp;md5=f050e3b86c834cb553ed832beaf0778b" type="text/html" />
	</item>
		<item>
		<title>Ubuntu 11.04 SBS (Small Business Server) Setup: Part 5 – NFS</title>
		<link>http://www.danbishop.org/2011/05/01/ubuntu-11-04-sbs-small-business-server-setup-part-5-%e2%80%93-nfs/</link>
		<comments>http://www.danbishop.org/2011/05/01/ubuntu-11-04-sbs-small-business-server-setup-part-5-%e2%80%93-nfs/#comments</comments>
		<pubDate>Sun, 01 May 2011 16:09:17 +0000</pubDate>
		<dc:creator>Dan Bishop</dc:creator>
				<category><![CDATA[Uncategorized]]></category>

		<guid isPermaLink="false">http://www.danbishop.org/?p=496</guid>
		<description><![CDATA[This is part of a guide to setting up Ubuntu Server Edition 11.04 for a small/medium business. The server will provide DHCP, DNS, NTP, LDAP, Kerberos and NFS services such that users can login to any machine on the network and all their files and settings will be the same across the entire network. Part [...]]]></description>
			<content:encoded><![CDATA[<div class="alignleft"><div class="g-plusone" data-href="http://www.danbishop.org/2011/05/01/ubuntu-11-04-sbs-small-business-server-setup-part-5-%e2%80%93-nfs/" size="small" count="true"></div></div><p>This is part of a guide to setting up Ubuntu Server Edition 11.04 for a small/medium business. The server will provide DHCP, DNS, NTP, LDAP, Kerberos and NFS services such that users can login to any machine on the network and all their files and settings will be the same across the entire network.</p>
<ul>
<ol><a href="http://www.danbishop.org/?p=483">Part 1 &#8211; DHCP and DNS</ol>
<ol><a href="http://www.danbishop.org/?p=487">Part 2 &#8211; NTP</a></ol>
<ol><a href="http://www.danbishop.org/?p=492">Part 3 &#8211; OpenLDAP</a></ol>
<ol><a href="http://www.danbishop.org/?p=494">Part 4 &#8211; Kerberos</a></ol>
<ol><a href="http://www.danbishop.org/?p=496">Part 5 &#8211; NFS</a></ol>
<ol><a href="http://www.danbishop.org/?p=498">Part 6 &#8211; Account Management</a></ol>
<ol><a href="http://www.danbishop.org/?p=500">Part 7 &#8211; Setting Up Clients</a></ol>
</ul>
<p>This section will help you configure NFS; using Kerberos to secure it.<span id="more-496"></span></p>
<p>The first step is to install the following NFS packages:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">apt-get</span> <span style="color: #c20cb9; font-weight: bold;">install</span> nfs-kernel-server nfs-common</pre></div></div>

<p>NFSv4 uses a pseudo filesystem by mounting the real directories you want to export under an export folder using the -bind mount option. We need to create this folder system as follows:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">mkdir</span> <span style="color: #000000; font-weight: bold;">/</span><span style="color: #7a0874; font-weight: bold;">export</span>
<span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">mkdir</span> <span style="color: #000000; font-weight: bold;">/</span>export<span style="color: #000000; font-weight: bold;">/</span>home</pre></div></div>

<p>In order to mount /home under /export/home each time the system boots, we need to modify /etc/fstab by adding the following line to the bottom of the file:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #000000; font-weight: bold;">/</span>home    <span style="color: #000000; font-weight: bold;">/</span>export<span style="color: #000000; font-weight: bold;">/</span>home   none    <span style="color: #7a0874; font-weight: bold;">bind</span>  <span style="color: #000000;">0</span>  <span style="color: #000000;">0</span></pre></div></div>

<p>This will take care of mounting the directories next time he server reboots, but for now we can manually mount it using:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> <span style="color: #c20cb9; font-weight: bold;">mount</span> <span style="color: #000000; font-weight: bold;">/</span>export<span style="color: #000000; font-weight: bold;">/</span>home</pre></div></div>

<p>Next we&#8217;re going to tell NFS what it should export by configuring the /etc/exports file like so:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">/export *(rw,fsid=0,crossmnt,insecure,async,no_subtree_check,sec=krb5p:krb5i:krb5)
/export/home *(rw,insecure,async,no_subtree_check,sec=krb5p:krb5i:krb5)</pre></div></div>

<p>Now we have to tell NFS to use Kerberos first by setting the following options in /etc/default/nfs-common:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">NEED_STATD=
STATDOPTS=
NEED_IDMAPD=yes
NEED_GSSD=yes</pre></div></div>

<p>Then by setting the following options in /etc/default/nfs-kernel-server:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">RPCNFSDCOUNT=8
RPCNFSDPRIORITY=0
RPCMOUNTDOPTS=--manage-gids
NEED_SVCGSSD=yes
RPCSVCGSSDOPTS=</pre></div></div>

<p>/etc/idmapd.conf needs to configured with the correct domain name for user/group name mappings:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">[General]
&nbsp;
Verbosity = 0
Pipefs-Directory = /var/lib/nfs/rpc_pipefs
Domain = danbishop.org
&nbsp;
[Mapping]
&nbsp;
Nobody-User = nobody
Nobody-Group = nogroup</pre></div></div>

<p>Next we need to create Kerberos principals for the NFS server.</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> kadmin.local <span style="color: #660033;">-q</span> <span style="color: #ff0000;">&quot;addprinc -randkey nfs/neo.danbishop.org&quot;</span>
<span style="color: #c20cb9; font-weight: bold;">sudo</span> kadmin.local <span style="color: #660033;">-q</span> <span style="color: #ff0000;">&quot;ktadd nfs/neo.danbishop.org&quot;</span></pre></div></div>

<p>sudo kadmin.local is used here as you need sudo privileges to write to /etc/krb5.keytab.</p>
<p>Finally, a small change is needed to enable weak encryption (the only type currently supported by NFS in Ubuntu) in Kerberos. This is done by editing /etc/krb5.conf and adding the following to the [libdefaults] section:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">allow_weak_crypto = true</pre></div></div>

 <p><a href="http://www.danbishop.org/?flattrss_redirect&amp;id=496&amp;md5=1a0480a043cbf7d1d13db57203369f7c" title="Flattr" target="_blank"><img src="http://www.danbishop.org/wp-content/plugins/flattr/img/flattr-badge-large.png" alt="flattr this!"/></a></p>]]></content:encoded>
			<wfw:commentRss>http://www.danbishop.org/2011/05/01/ubuntu-11-04-sbs-small-business-server-setup-part-5-%e2%80%93-nfs/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
		<atom:link rel="payment" href="http://www.danbishop.org/?flattrss_redirect&amp;id=496&amp;md5=1a0480a043cbf7d1d13db57203369f7c" type="text/html" />
	</item>
	</channel>
</rss>

