<?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>Alt om ingenting og litt i mellom &#187; Courier-IMAP</title>
	<atom:link href="http://hovenko.no/blog/tag/courier-imap/feed/" rel="self" type="application/rss+xml" />
	<link>https://hovenko.no/blog</link>
	<description>En blogg av Knut-Olav</description>
	<lastBuildDate>Mon, 10 Mar 2025 19:25:02 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Cryptic error message from Courier IMAP server &#8211; Permission Denied</title>
		<link>https://hovenko.no/blog/2012/07/02/cryptic-error-message-from-courier-imap-server-permission-denied/</link>
		<comments>https://hovenko.no/blog/2012/07/02/cryptic-error-message-from-courier-imap-server-permission-denied/#comments</comments>
		<pubDate>Mon, 02 Jul 2012 00:40:24 +0000</pubDate>
		<dc:creator>Knut-Olav</dc:creator>
				<category><![CDATA[English-posts]]></category>
		<category><![CDATA[Server]]></category>
		<category><![CDATA[Teknologi]]></category>
		<category><![CDATA[Courier-IMAP]]></category>
		<category><![CDATA[Debian]]></category>
		<category><![CDATA[debugging]]></category>
		<category><![CDATA[IT]]></category>
		<category><![CDATA[server]]></category>

		<guid isPermaLink="false">http://hovenko.no/blog/?p=749</guid>
		<description><![CDATA[I have debugged this error message for the last couple of days. Jul 1 23:11:56 lance imapd: LOGIN, user=knut-olav@hoven.ws, ip=[::ffff:AAA.BBB.CCC.DDD], port=[48700], protocol=IMAP Jul 1 23:11:56 lance imapd: knut-olav@hoven.ws: Permission denied The solution was pretty simple. The /tmp folder had bad permissions. This server was only meant for hosting email services, so bad permissions on /tmp [...]]]></description>
			<content:encoded><![CDATA[<p>I have debugged this error message for the last couple of days.<br />
<code>
<pre>Jul  1 23:11:56 lance imapd: LOGIN, user=knut-olav@hoven.ws, ip=[::ffff:AAA.BBB.CCC.DDD], port=[48700], protocol=IMAP
Jul  1 23:11:56 lance imapd: knut-olav@hoven.ws: Permission denied</pre>
<p></code></p>
<p>The solution was pretty simple.</p>
<p>The /tmp folder had bad permissions. This server was only meant for hosting email services, so bad permissions on /tmp folder was actually not an issue earlier.</p>
<p>I guess the wrong permissions were caused by my custom XEN node setup using multiple partitions, including a partition just for /tmp.</p>
<p><strong>Debugging was quite hard</strong></p>
<p>Authentication was successful, as I got a different error message when authenticating with a known bad password.</p>
<p>I debugged it using strace. It wasn&#8217;t easy, as courier imap forks out child processes for each connection, which I had to strace as well.</p>
<p><code>
<pre># strace /usr/sbin/couriertcpd -address=0 -maxprocs=40 -maxperip=20 -nodnslookup -noidentlookup 143 /usr/lib/courier/courier/imaplogin /usr/bin/imapd Maildir</pre>
<p></code></p>
<p>Connect to port 143 using telnet.<br />
Log in using this command:<br />
<code>
<pre>i login MY_EMAIL_USERNAME MY_PASSWORD
</pre>
<p></code></p>
<p>Then find the imap process PID. Look for a process running as user <tt>vmail</tt>:</p>
<p><code>
<pre>$ ps axuw|grep imapd
#...
vmail      362  0.0  1.0   4616  1344 ?        S    01:46   0:00 /usr/bin/imapd /var/spool/mail/vmail/hoven.ws/knut-olav/Maildir/
#...
</pre>
<p></code></p>
<p>In this case, the PID is 362. Then attach strace to it using <tt>strace -p 362</tt>, as sudo.</p>
<p>From the telnet interface, I entered a couple of commands like these:<br />
<code>
<pre>2 select "INBOX"
5 UID fetch 1:10 (UID RFC822.SIZE FLAGS BODY.PEEK[HEADER.FIELDS (From To Cc Bcc Subject Date Message-ID Priority X-Priority References Newsgroups In-Reply-To Content-Type)])
</pre>
<p></code></p>
<p>Then I found this somewhere down into the strace output:<br />
<code>
<pre>
open("/tmp/tmpfWsezjv", O_RDWR|O_CREAT|O_EXCL, 0600) = -1 EACCES (Permission denied)
write(2, "ERR: knut-olav@hoven.ws: Permiss"..., 43) = 43
</pre>
<p></code></p>
<p><strong>Fixing the problem</strong><br />
<tt>chmod 1777 /tmp</tt></p>
<p>As I wrote earier&#8230; a simple solution.</p>
]]></content:encoded>
			<wfw:commentRss>https://hovenko.no/blog/2012/07/02/cryptic-error-message-from-courier-imap-server-permission-denied/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
