<?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>code(alpha)</title>
	<atom:link href="http://www.codealpha.net/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.codealpha.net</link>
	<description>Tips &#38; Tutorials for Linux</description>
	<lastBuildDate>Sat, 21 Aug 2010 14:54:30 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>How to create a simple approval queue with Request Tracker (RT) 3.8</title>
		<link>http://www.codealpha.net/664/how-to-create-a-simple-approval-queue-with-request-tracker-rt-3-8/</link>
		<comments>http://www.codealpha.net/664/how-to-create-a-simple-approval-queue-with-request-tracker-rt-3-8/#comments</comments>
		<pubDate>Sat, 21 Aug 2010 14:39:23 +0000</pubDate>
		<dc:creator>Arnaud Soyez</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[request tracker]]></category>
		<category><![CDATA[rt]]></category>

		<guid isPermaLink="false">http://www.codealpha.net/?p=664</guid>
		<description><![CDATA[Introduction In this post I will show how to create a simple approval queue in Request Tracker 3.8. The General queue will be used as the approval queue. Here are the different entities (groups) we will create: Submitters: they can submit new tickets only to the General Queue. Approvers: they can approve tickets (move them [...]]]></description>
			<content:encoded><![CDATA[<h2>Introduction</h2>
<p>In this post I will show how to create a simple approval queue in <a href="http://bestpractical.com/rt/">Request Tracker 3.8</a>.</p>
<div style="text-align:center"><img src="http://www.codealpha.net/wp-content/uploads/2010/08/300px-Rt3.8-ticket-list.png" alt="Request Tracker" title="Request Tracker" width="300" height="195" class="aligncenter size-full wp-image-677" /></div>
<p>The <strong>General queue</strong> will be used as the approval queue.</p>
<p>Here are the different entities (groups) we will create:</p>
<ul>
<li><strong>Submitters</strong>: they can submit new tickets only to the General Queue.</li>
<li><strong>Approvers</strong>: they can approve tickets (move them from the general queue to another queue)</li>
</ul>
<p>I will also show how to add a new dashlet ("<strong>RT at a glance</strong>") containing all the tickets the user created ("My issues").</p>
<p><span id="more-664"></span></p>
<h2>Permissions and Rights</h2>
<p>In preferences, make sure the General queue is the default queue.</p>
<p>Create your other queues as needed.</p>
<p>First, we'll allow all requestors (person who created/initiated a new ticket) to see all tickets they created and also be able to reply to them. In <em>Configuration &gt; Global &gt; Group rights</em>, for the <strong>Requestors</strong> group add the following rights:</p>
<ul>
<li>ShowTicket</li>
<li>ReplyTicket</li>
</ul>
<h3>Submitters</h3>
<p>In <em>Configuration &gt; Groups &gt; Create</em>, create a group called "Submitters".</p>
<p>To allow the submitters to create new tickets to the general queue, go to <em>Configuration &gt; Queues</em> open the <strong>General</strong> queue, click on Group Rights (top menu), add the following rights to the "Submitters" group:</p>
<ul>
<li>SeeQueue</li>
<li>ShowTicket</li>
<li>CreateTicket</li>
</ul>
<p>For the submitters to be able to see their tickets (which they created) after they have been moved to another queue, they need some READ rights on all other queues. Go to <em>Configuration &gt; Queues</em>, <strong>for each queue</strong>, add the following <strong>Group Rights</strong> to the <strong>Submitters</strong> group:</p>
<ul>
<li>SeeQueue</li>
<li>ShowTicket</li>
</ul>
<h3>Approvers</h3>
<p>In <em>Configuration &gt; Groups &gt; Create</em>, create a group called "Approvers".</p>
<p>We need to allow the Approvers to see and create tickets in every queue, go to <em>Configuration &gt; Queues</em> and <strong>for each queue</strong> click on Group Rights (top menu), add the following rights to the "Approvers" group:</p>
<ul>
<li>SeeQueue</li>
<li>ShowTicket</li>
<li>CreateTicket</li>
</ul>
<p>Now they need to be able to <strong>modify</strong> tickets that are in the <strong>General Queue</strong>, go to <em>Configuration &gt; Queues &gt; General</em>  click on Group Rights (top menu), add the following rights to the "Approvers" group:</p>
<ul>
<li>SeeQueue</li>
<li>ShowTicket</li>
<li>CreateTicket</li>
<li>ModifyTicket</li>
</ul>
<h2>Dashlet for "My Issues"</h2>
<p>Now we allow the <strong>privileged</strong> users to use saved searches and dashboards: in <em>Configuration &gt; Global &gt; Group Rights</em>, find the "Privileged" group and add the following rights:</p>
<ul>
<li>LoadSavedSearch</li>
<li>ModifyOwnDashboard</li>
<li>ShowSavedSearches</li>
<li>SubscribeDashboard</li>
</ul>
<p>In <em>Tickets </em> go to <em>Advanced</em> (top menu), copy and paste the following query in the first textfield:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">(Creator = '__CurrentUser__')</pre></div></div>

<p>Click on <em>Edit Search</em> (top menu), tweak the search as necessary. When done, save it as an <strong>RT's system saved search</strong> (in the dashlet called "Saved searches"). Pick a name ("My Issues" for example).</p>
<p>Then we need to the change the default <em>RT at a glance</em>, go to <em>Configuration &gt; Global &gt; RT at a glance</em><br />
<br/>In <strong>RT at a glance: body</strong>, on the left column <strong>select your saved search</strong> ("My Issues") and click the <strong>right</strong> arrow. Then in the right column, you can move your dashlet up and down.</p>
<h2>Conclusion</h2>
<p>Now you can add new users and assign them to the <strong>Submitters group</strong> or the <strong>Approvers group</strong>, or even both.<br />
<strong>Submitters</strong> can create new tickets and still see them if they are moved to another queue or changed ownership.<br />
<strong>Approvers</strong> can move tickets from the General queue to other queues.<br />
<strong>Every privileged user</strong> should now see the "My issues" dashlet on their dashboard.</p>
<p><strong>Of course, I am giving the strict minimum amount of rights necessary to achieve this, but you are free to add more rights (e.g. add the Watch right, or ReplyTicket right to Approvers) if you need them</strong></p>
]]></content:encoded>
			<wfw:commentRss>http://www.codealpha.net/664/how-to-create-a-simple-approval-queue-with-request-tracker-rt-3-8/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to set up Expires header with Apache2 on Ubuntu Lucid 10.04</title>
		<link>http://www.codealpha.net/649/how-to-set-up-expires-header-with-apache2-on-ubuntu-lucid-10-04/</link>
		<comments>http://www.codealpha.net/649/how-to-set-up-expires-header-with-apache2-on-ubuntu-lucid-10-04/#comments</comments>
		<pubDate>Tue, 27 Jul 2010 23:02:20 +0000</pubDate>
		<dc:creator>Arnaud Soyez</dc:creator>
				<category><![CDATA[Tutorials]]></category>
		<category><![CDATA[apache]]></category>
		<category><![CDATA[cache]]></category>
		<category><![CDATA[ubuntu]]></category>

		<guid isPermaLink="false">http://www.codealpha.net/?p=649</guid>
		<description><![CDATA[A very good way to reduce page load time on your website is to tell your visitors' browser it can cache some specific files and save a copy on the disk. This process is done by your web-server which is sending an Expires header and a max-age header during the HTTP response, e.g.: 200 OK [...]]]></description>
			<content:encoded><![CDATA[<p>A very good way to reduce page load time on your website is to tell your visitors' browser it can cache some specific files and save a copy on the disk.<br/><br />
This process is done by your web-server which is sending an <strong><em>Expires</em></strong> header and a <em><strong>max-age</strong></em> header during the HTTP response, e.g.:</p>
<div class="codewrapper"><code>200 OK<br />
<strong>Cache-Control: max-age=604800</strong><br />
Connection: close<br />
Date: Tue, 27 Jul 2010 22:31:03 GMT<br />
Accept-Ranges: bytes<br />
ETag: "2c956-376b-4696cb8b385c0"<br />
Server: Apache/2.2.14 (Ubuntu)<br />
Content-Length: 14187<br />
Content-Type: image/gif<br />
<strong>Expires: Tue, 03 Aug 2010 22:31:03 GMT</strong><br />
Last-Modified: Fri, 08 May 2009 20:46:23 GMT<br />
Client-Date: Tue, 27 Jul 2010 22:31:02 GMT<br />
Client-Peer: 127.217.30.5:80<br />
Client-Response-Num: 1</code></div>
</pre>
<p>Apache2 offers this feature through its <strong><a href="http://httpd.apache.org/docs/2.0/mod/mod_expires.html">mod_expires</a></strong> module. Note that this module is <strong>usually disabled by default</strong>, meaning your visitors would download all the files over again each time they change the page.</p>
<p><span id="more-649"></span></p>
<ul>
<li>First, to activate <em>mod_expires</em>, type this in a terminal:

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

</li>
<li>Then, we need to tell Apache2 which files can have an expire header. You can add this in your vhost configuration or your main apache2 configuration file you want it to apply to every vhost:

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">ExpiresActive On
ExpiresByType image/gif &quot;access plus 7 days&quot;
ExpiresByType image/jpeg &quot;access plus 7 days&quot;
ExpiresByType image/png &quot;access plus 7 days&quot;
ExpiresByType image/x-icon &quot;access plus 3 months&quot;
ExpiresByType image/ico &quot;access plus 3 months&quot;
ExpiresByType text/css &quot;access plus 2 days&quot;</pre></div></div>

</li>
<li>Remember to restart Apache2:

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

</li>
<li>You can look at the headers sent by your webserver using HEAD (on a linux machine) like so:

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">HEAD http:<span style="color: #000000; font-weight: bold;">//</span>www.codealpha.net<span style="color: #000000; font-weight: bold;">/</span>wp-content<span style="color: #000000; font-weight: bold;">/</span>themes<span style="color: #000000; font-weight: bold;">/</span>notso_freshe<span style="color: #000000; font-weight: bold;">/</span>images<span style="color: #000000; font-weight: bold;">/</span>header.gif</pre></div></div>

</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.codealpha.net/649/how-to-set-up-expires-header-with-apache2-on-ubuntu-lucid-10-04/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>User of stackoverflow or serverfault? Help us create one for Ubuntu!</title>
		<link>http://www.codealpha.net/643/user-of-stackoverflow-or-serverfault-help-us-create-one-for-ubuntu/</link>
		<comments>http://www.codealpha.net/643/user-of-stackoverflow-or-serverfault-help-us-create-one-for-ubuntu/#comments</comments>
		<pubDate>Fri, 16 Jul 2010 21:37:44 +0000</pubDate>
		<dc:creator>Arnaud Soyez</dc:creator>
				<category><![CDATA[News]]></category>

		<guid isPermaLink="false">http://www.codealpha.net/?p=643</guid>
		<description><![CDATA[Are you a user of stackoverflow or serverfault? You will be interested in the fact that you can help create a site similar to those above but for Ubuntu!!! Click here to participate and help to create a Q&#38;A site for Ubuntu!]]></description>
			<content:encoded><![CDATA[<p>Are you a user of <strong><a href="http://stackoverflow.com">stackoverflow</a></strong> or <strong><a href="http://serverfault.com">serverfault</a></strong>?<br />
You will be interested in the fact that<strong> you can help create a site similar</strong> to those above but <strong>for Ubuntu</strong>!!!</p>
<h2>
<a href="http://area51.stackexchange.com/proposals/7716/ubuntu?referrer=8r2uuSUOAHGa9ulpRNYX7g2">Click here to participate and help to create a Q&amp;A site for Ubuntu!</a></h2>
]]></content:encoded>
			<wfw:commentRss>http://www.codealpha.net/643/user-of-stackoverflow-or-serverfault-help-us-create-one-for-ubuntu/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Name-Based Virtual Hosts with SSL using Apache2 on Ubuntu Lucid</title>
		<link>http://www.codealpha.net/631/name-based-virtual-hosts-with-ssl-using-apache2-on-ubuntu-lucid/</link>
		<comments>http://www.codealpha.net/631/name-based-virtual-hosts-with-ssl-using-apache2-on-ubuntu-lucid/#comments</comments>
		<pubDate>Mon, 12 Jul 2010 00:37:03 +0000</pubDate>
		<dc:creator>Arnaud Soyez</dc:creator>
				<category><![CDATA[Miscellaneous]]></category>

		<guid isPermaLink="false">http://www.codealpha.net/?p=631</guid>
		<description><![CDATA[It has now been a few years (2007) that SNI (Server Name Indication) has been introduced/supported in OpenSSL 0.9.8, but it has only been just last year that SNI was fully supported in Apache2 with version 2.2.12 released in July 2009. Now we can really having multiple virtual hosts with different certificates on the same [...]]]></description>
			<content:encoded><![CDATA[<p>It has now been a few years (2007) that SNI (Server Name Indication) has been introduced/supported in OpenSSL 0.9.8, but it has only been just last year that SNI was fully supported in Apache2 with version 2.2.12 released in July 2009. Now we can really having<br />
  multiple virtual hosts with different certificates on the same IP address! No need to buy any more IP addresses!</p>
<p><span id="more-631"></span></p>
<h2>Introduction</h2>
<p>This tutorial is mainly oriented to Ubuntu, but can also be applied to other distributions such as Debian.</p>
<p>The <b>minimum requirements</b> for SNI to work are <b>Apache 2.2.12</b> (or higher) with <b>OpenSSL 0.9.8g</b> (or higher).</p>
<p>Make sure you already have your website(s) set up and running (non-SSL of course!) and listening on another port than 443 as we will use this port for SSL.</p>
<h2>Installation of packages</h2>
<p>We need to activate the <i>Apache2 SSL</i> module in order to serve websites over SSL:</p>

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

<p>Also, the <i>ssl-cert</i> package will allow us to create certificates in a few keystrokes:</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> ssl-cert</pre></div></div>

<p>If you don't have <i>ssl-cert</i> available in your distribution's package manager, you can find it here: <a href="http://packages.debian.org/sid/ssl-cert">http://packages.debian.org/sid/ssl-cert</a></p>
<h2>Creating certificates</h2>
<p>We will now create a self-signed SSL certificate.</p>
<p>When using <i>make-ssl-cert</i>, both the certificate and the private key are generated and stored within the same file. The generated <i>*.crt</i> file needs to be kept somewhere safe on your disk, it is a good practice to move it to /etc/ssl/privateand use <i>chmod 600</i> and <i>chown root:root</i>. <b>It should be readable by root only!</b></p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;"><span style="color: #c20cb9; font-weight: bold;">sudo</span> make-ssl-cert <span style="color: #000000; font-weight: bold;">/</span>usr<span style="color: #000000; font-weight: bold;">/</span>share<span style="color: #000000; font-weight: bold;">/</span>ssl-cert<span style="color: #000000; font-weight: bold;">/</span>ssleay.cnf \
<span style="color: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>ssl<span style="color: #000000; font-weight: bold;">/</span>private<span style="color: #000000; font-weight: bold;">/</span>mydomain.crt</pre></div></div>

<p>It should ask you for a <b>hostname</b>, enter the exact domain name of the website (e.g. if you want to use <i>https://www.myexampledomain.com</i> then put <i>www.myexampledomain.com</i>as<br />
  hostname).</p>
<h2>Enabling name-based SSL virtual hosts</h2>
<p>Apache2 needs to know that our virtual hosts using SSL will be matched using a name-based matching rule (instead of IP-based) and also that it needs to listen for SSL connections on port 443.</p>
<p>Open the Apache2 ports config file, located at <i>/etc/apache2/ports.conf</i> and add:</p>

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

<p>It should look similar to this:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">NameVirtualHost *:80
NameVirtualHost *:443
&nbsp;
Listen 80
&nbsp;
&lt;IfModule mod_ssl.c&gt;
    Listen 443
&lt;/IfModule&gt;</pre></div></div>

<p>Make surethere is <i>Listen 443</i> somewhere in this file, in order to tell Apache2 to listen on this specific port for SSL connections.</p>
<h2>Creating the virtual hosts configuration file</h2>
<p><b>Important Note:<br /></b>Note that not all browsers support SNI. For those without SNI support they will be redirected to the first SSL vhost defined (which is usually the first alphabetically in the <i>/sites-enabled/</i> folder) in<br />
  the Apache2 configuration.<br />
  Also, it is good to know that in their browser, they will see the domain name that they typed in instead of the actual vhost's domain name, as a consequence the certificate will not be validated as it will not match the domain shown in their browser. As an alternative you can use <i>SSLStrictSNIVHostCheck</i>, see note below.</p>
</p>
<p>The best thing to do is to copy the normal configuration file of your website (with normal <i>http://</i> access) and add the SSL directives.</p>
<p>First, make a copy:</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: #000000; font-weight: bold;">/</span>etc<span style="color: #000000; font-weight: bold;">/</span>apache2<span style="color: #000000; font-weight: bold;">/</span>sites-available<span style="color: #000000; font-weight: bold;">/</span><span style="color: #7a0874; font-weight: bold;">&#123;</span>mywebsite.conf,mywebsite_ssl.conf<span style="color: #7a0874; font-weight: bold;">&#125;</span></pre></div></div>

<p>Then open the <i>mywebsite_ssl.conf</i> file, and add/modify the bold parts:</p>

<div class="wp_syntax"><div class="code"><pre class="text" style="font-family:monospace;">&lt;VirtualHost *:443&gt;
 ServerName www.myexampledomain.com 
&nbsp;
 SSLEngine On
 SSLCertificateFile /etc/ssl/private/myexampledomain.crt 
&nbsp;
 DocumentRoot /var/www/myexampledomain
&lt;/VirtualHost&gt;</pre></div></div>

<p>Explanation:</p>
<p>“<b>*:443</b>” along with <i>ServerName</i> define this configuration as a name-based virtual host.</p>
<p>“<b>SSLEngine On</b>” enables SSL for this virtual host.</p>
<p>“<b>SSLCertificateFile</b>”points to the certificate we created earlier.</p>
</p>
<p>Note:<br />Using <i>SSLStrictSNIVHostCheck</i>it will refuse non SNI capable browsers to access any website on your server using SSL.<br /><i>This directive sets<br />
  whether a non SNI client is allowed to access a name based virtual host. If set to</i> <code>on</code> <i>in the non default name based virtual host, non SNI clients are not allowed to access this particular virtual host. If set<br />
  to</i> <code>on</code> <i>in the default name based virtual host, non SNI clients are not allowed to access any name based virtual host belonging to this IP / port combination. (</i><a href="http://httpd.apache.org/docs/2.2/mod/mod_ssl.html#SSLStrictSNIVHostCheck">http://httpd.apache.org/docs/2.2/mod/mod_ssl.html#SSLStrictSNIVHostCheck</a><i>)</i></p>
<h2>Enabling the virtual host</h2>
<p>We need to enable the virtual host, this is an important step which is often forgotten:</p>

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

<h2>Testing</h2>
<p>Restart Apache2:</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 apache2 restart</pre></div></div>

<p>This is time for a test, visit your website over SSL, make sure you prepend <i>https://</i> to your domain name (for example <i>https://www.myexampledomain.com</i>)</p>
<h2>Troubleshooting</h2>
<p>If you cannot see your website using <i>https</i> you can dig into the Apache2 logs (located at <i>/var/log/apache2/error.log</i>) and search for <i>[error]</i> or <i>[warn]</i>.</p>
<p>Also be certain to have activated/enabled all of the virtual hosts you want by typing <i>sudo a2ensite yourdomain.conf</i> and then reload or restart Apache2.</p>
<p>If you get a “ssl_error_rx_record_too_long” error, it can mean either SSL is not activated properly for this virtual host (check that there is <i>SSLEngine On</i> in your vhost config) or the virtual host configuration is not enabled<br />
  (“<i>sudo a2ensite vhostconfigfile</i>”).</p>
<h2>Notes</h2>
<p>If you already have your own certificates, you will want to use both <i>SSLCertificateKeyFile</i>and <i>SSLCertificateFile</i>in the virtual host configuration file because certificate issuers usually give<br />
  you two different files (one containing a private key and the other one containing the certificate).</p>
<p>It is important to be aware that some browsers do not support SNI and will not be able to access your virtual hosts.</p>
<p>Some browsers in mobile devices might not support SNI so be certain that your default SSL virtual host can provide some help or support to those users, like for example offering the option to switch back to regular non-SSL connection.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.codealpha.net/631/name-based-virtual-hosts-with-ssl-using-apache2-on-ubuntu-lucid/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>How to backup MySQL users except root on Ubuntu</title>
		<link>http://www.codealpha.net/624/how-to-backup-mysql-users-on-ubuntu/</link>
		<comments>http://www.codealpha.net/624/how-to-backup-mysql-users-on-ubuntu/#comments</comments>
		<pubDate>Sat, 10 Jul 2010 18:24:11 +0000</pubDate>
		<dc:creator>Arnaud Soyez</dc:creator>
				<category><![CDATA[Tips]]></category>
		<category><![CDATA[backup]]></category>
		<category><![CDATA[mysql]]></category>
		<category><![CDATA[mysqldump]]></category>
		<category><![CDATA[privileges]]></category>
		<category><![CDATA[root]]></category>
		<category><![CDATA[ubuntu]]></category>
		<category><![CDATA[users]]></category>

		<guid isPermaLink="false">http://www.codealpha.net/?p=624</guid>
		<description><![CDATA[When you want to backup your mysql databases, you usually do mysqldump ... --all-databases or mysqldump ... --databases mysql ... but you end up with the whole mysql table which is a pain to insert back when you need it because it can mess up the root password or the debian-sys-maint user... If you wish [...]]]></description>
			<content:encoded><![CDATA[<p>When you want to backup your mysql databases, you usually do <em>mysqldump ... --all-databases</em> or <em>mysqldump ... --databases mysql ...</em> but you end up with the whole <em>mysql</em> table which is a pain to insert back when you need it because it can mess up the root password or the debian-sys-maint user...</p>
<p>If you wish to just backup all the users and privileges other than root and debian-sys-maint, you can use this command:</p>

<div class="wp_syntax"><div class="code"><pre class="bash" style="font-family:monospace;">mysqldump <span style="color: #660033;">-nt</span> <span style="color: #660033;">-uroot</span> <span style="color: #660033;">-p</span> <span style="color: #660033;">-w</span><span style="color: #ff0000;">&quot;User NOT LIKE 'root' AND User NOT LIKE 'debian%'&quot;</span> mysql user db <span style="color: #000000; font-weight: bold;">&gt;</span> users_privs.sql</pre></div></div>

<p>Here's an explanation of each of the options:</p>
<ul>
<li><strong>-nt</strong>: Do not add "drop table" and "create table".</li>
<li><strong>-uroot -p</strong>: Connect as root and ask for a password</li>
<li><strong>-w...</strong>: Add a "WHERE" condition to each query. We exclude everything related to root and debian-sys-maint.</li>
<li><strong>mysql user db</strong>: Dump the <em>user</em> and <em>db</em> tables from the <em>mysql</em> database.</li>
<li><strong>&gt; users_privs.sql</strong>: Store the sql dump into the <em>users_privs.sql</em> file.</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://www.codealpha.net/624/how-to-backup-mysql-users-on-ubuntu/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
