LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   Courier issues: no such file or directory when testing IMAP and POP (https://www.linuxquestions.org/questions/linux-server-73/courier-issues-no-such-file-or-directory-when-testing-imap-and-pop-822639/)

elorc 07-28-2010 10:01 AM

Courier issues: no such file or directory when testing IMAP and POP
 
Using the following software:
  • Ubuntu Server 8.04
  • SquirrelMail 1.4.13
  • Postfix 2.5.1
  • Courier 0.59.0 (Courier-IMAP 4.3.1)
  • Apache2 2.2.8

I've installed a mail server per the instructions at http://howtoforge.com/virtual-users-...ail-ubuntu8.04. Neither POP nor IMAP test successfully with the user that I just added after following the setup instructions.

IMAP:
# telnet localhost 143
Trying 127.0.0.1...
Connected to localhost.localdomain.
Escape character is '^]'.
* OK [CAPABILITY IMAP4rev1 UIDPLUS CHILDREN NAMESPACE THREAD=ORDEREDSUBJECT THREAD=REFERENCES SORT QUOTA IDLE ACL ACL2=UNION STARTTLS] Courier-IMAP ready. Copyright 1998-2008 Double Precision, Inc. See COPYING for distribution information.
01 LOGIN testuser@mydomain.dom Testpassword
* BYE [ALERT] Fatal error: mydomain.com/testuser/: No such file or directory
Connection closed by foreign host.
POP:
# telnet localhost 110
Trying 127.0.0.1...
Connected to localhost.localdomain.
Escape character is '^]'.
+OK Hello there.
user testuser@mydomain.com
+OK Password required.
pass Testpassword
-ERR chdir mydomain.com/testuser/ failed
Connection closed by foreign host.
This doesn't make any sense. I added the user to the mysql database:

Code:

mysql> select * from users;
+------------------------+---------------+----------+
| email                  | password      | quota    |
+------------------------+---------------+----------+
| firstuser@mydomain.com | Xhjv3NJGut846 | 10485760 |
| testuser@mydomain.com  | LKJsg57bdgjle | 10485760 |
+------------------------+---------------+----------+
2 rows in set (0.00 sec)

And after I did that, I ran the postfix reload command. If I try to log in as firstuser@mydomain.com, which is the user I created during the setup and configuration process, it works fine.

I checked the virtual mail account's home folder, and under the mydomain.com folder, I only see a folder for firstuser. I'd create one for testuser manually, but I don't know if that'll work since it seems to contain a particular folder structure of its own.

What am I missing? Is there some other command that I have to run? I don't recall having to do anything additional when setting up firstuser.

Noway2 07-28-2010 06:47 PM

A couple of hints:
1 - look very carefully at the .cnf files you created. Look for any odd ' or ` characters as these don't translate well and any blank spaces at the end of the lines.
2 - there may be an issue with the setup (main.cf) for your virtual user mappings.
3 - What process did you use to create the first user and how does it differ from the second? You appear to be really close to having your server functional if the first user works correctly.
4 - look in your mail.log for any error messages. Sometimes they can be cryptic but any sort of error or warning is a clue that something (a configuration file usually) has a bug in it.

You may be able to turn on debugging in courier (check the documentation to see what it supports and how) which may provide more information regarding what is happening.

elorc 07-28-2010 07:30 PM

The process I used to create the first user was step 13 on that guide. Specifically:
  1. Populate the domain table: INSERT INTO `domains` (`domain`) VALUES ('example.com');
  2. Add the first user to the database: INSERT INTO `users` (`email`, `password`, `quota`) VALUES ('sales@example.com', ENCRYPT('secret'), 10485760);
  3. Skipped forwarding and transport tables.
  4. Ran command: postfix reload

That's all I did, which is exactly what I did for the second user (minus the population of the domain table since that was already done). :(

Postfix reload is supposed to build the folder structure for the new users, correct?

Noway2 07-29-2010 04:19 AM

If you change anything in postfix's main or master.cf postfix reload will cause it to refresh the configuration files. Since you are using virtual users, you should be able to add one via the database and not have to do anything with postfix.

Lets try this. Send a test email via the first user, the one that is working, and then attempt to send one that is not working. Next, take a loot at your log (probably /var/mail.log) and you should see about 10 lines associated with those two access attempts. Copy those lines, removing any information your not comfortable posting on the forum, such as an email address, and lets take a look at what errors you are getting.

You probably have something simple that isn't quite right, but without the error information we are only guessing as to what. Focus on sending mail first which uses the Postfix portion of the system. Next, we will look at receiving mail which involves courier.

If you would like an example of what I meant by ` back ticks and ' single quotes, look at your reply to me. Half of the entries in your lines contain ` marks which your database program will choke on as these need to be single quotes. If you got one or more of these wrong (e.g. copied and pasted text from the how to) on your second user it is possible that is the problem.

elorc 07-29-2010 09:12 AM

Interesting, I think I figured it out. One thing I did that I didn't mention is that I used mailx to send a test email to the first account. I did not do that with the second account.

I got the second account working by copying the first user's folder structure and removing any mail items within it. That worked. But for the hell of it, I created a third user in the MySQL table. As expected, no folder popped up. So I used mailx to send an email to it. Sure enough, the folder structure for the third user was automatically created.

jamrock 07-29-2010 11:34 AM

I think you need to make a distinction between users and mailboxes.

When you send mail to a Postfix server, it checks to see if the user exists. If the user does not exist, it rejects the mail.

If the user exists, it checks for the user's mailbox. If the mailbox exists, the mail is put in the relevant folder.

If the mailbox does not exist, Postfix creates it and puts the mail in the relevant folder.

When you create the user in Mysql, you are creating the user and not the user's mailbox. Sending the first mail creates the mailbox.

Courier is checking for the mailbox. Since it hasn't been created yet, it says "no such file or directory".


All times are GMT -5. The time now is 12:38 PM.