LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 06-24-2005, 10:46 AM   #1
hawkpaul
Member
 
Registered: Nov 2001
Location: Black Mountain , NC
Distribution: Debian
Posts: 46

Rep: Reputation: 15
Automatically create virtual mail Courier Imap account


I have a server running Debian Woody with Postfix, Courier IMAP and Squirrelmail. The server runs fine but I want to be able to automate the creation of users.

When I started, creating virtual user account was a bit of a process so I wrote a script that took care of most of it. Here is the script I am using:

______________________________________________________________
#
#Script to create virtual user for email account
#

echo "Enter the username:"
read uname
maildirmake /home/vmail/Maildir-$uname
chown vmail /home/vmail/Maildir-$uname
userdb "$uname" set home=/home/vmail mail=/home/vmail/Maildir-$uname uid=1002 gid=100
userdbpw | userdb "$uname" set imappw
makeuserdb
echo $uname@mydomain.com Maildir-$uname/ >> /etc/postfix/vmailbox
postmap /etc/postfix/virtual
postmap /etc/postfix/vmailbox
postfix reload
chown -R vmail /home/vmail/Maildir-$uname
chgrp -R users /home/vmail/Maildir-$uname

_______________________________________________________________

This works just fine. It asks me to enter the username and then I have to enter the password twice. I would like to be able to set this to automatically run when one of my users signs up for email.

The only thing that is getting in my way is that it asks me for a password. I would like to designate the password in the script. I have read a few sites that say I can do that by changing my "userdbpw" line to this:


userdbpw | userdb "$uname" set imappw=password

Where "password" is the password I want to give to the user. That great except that it doesn't work. It still asks me for the password. If I cancel out when it asks me for the password and then check out the /etc/courier/usedb file the correct password shows up but it doesn't work when I try to log in. All the others that were created the default way seem to be encrypted but the one where I used imappw=password is just plain text.

Does anyone know what I need to do to get this to work?

Sorry for the long post. Thanks for the help!

Hawkpaul
 
Old 06-24-2005, 11:42 AM   #2
palmer24
LQ Newbie
 
Registered: Jun 2005
Location: Washington DC
Distribution: Debian
Posts: 2

Rep: Reputation: 0
What version of Courier IMAP are you running?
 
Old 06-24-2005, 11:43 AM   #3
hawkpaul
Member
 
Registered: Nov 2001
Location: Black Mountain , NC
Distribution: Debian
Posts: 46

Original Poster
Rep: Reputation: 15
courier-imap_1.4.3-2.3
 
Old 06-24-2005, 01:22 PM   #4
palmer24
LQ Newbie
 
Registered: Jun 2005
Location: Washington DC
Distribution: Debian
Posts: 2

Rep: Reputation: 0


Have you tried just running;

userdbpw | userdb "$uname" set imappw=password

from the command line after the user account is created to change the password?

p24
 
Old 06-24-2005, 01:41 PM   #5
hawkpaul
Member
 
Registered: Nov 2001
Location: Black Mountain , NC
Distribution: Debian
Posts: 46

Original Poster
Rep: Reputation: 15
Yeah I tried that. After doing that I checked out /etc/courier/userdb and found an entry in there for that user with the correct password but the password doesn't work. I think the reason it doesn;t work is becasue all of the other passwords seem to be encrypted and the one I put in just shows up in plain text.
 
Old 06-29-2005, 08:41 AM   #6
hawkpaul
Member
 
Registered: Nov 2001
Location: Black Mountain , NC
Distribution: Debian
Posts: 46

Original Poster
Rep: Reputation: 15
Unhappy

I have asked this question at a bunch of different forums and the only answer I have gotten is to try to just run userdb by itself like this:

userdb "$uname" set imappw=password

This works but the problem is that the password isn't encrypted. It just gets put into the /etc/courier/userdb file as plain text.

At this point I really don't care if it is in plain text but the problem is that IMAP seems to need the passwords to be encrypted because the log-ins that I created that store the plain text passwords don't work.

So, is there any way I can tell Courier IMAP to look for plain text passwords when it reads userdb?

Hawkpaul
 
Old 06-29-2005, 09:06 AM   #7
hawkpaul
Member
 
Registered: Nov 2001
Location: Black Mountain , NC
Distribution: Debian
Posts: 46

Original Poster
Rep: Reputation: 15
Smile

I just got the answer from another forum. All I had to do was add echo "password" | in front of the command. So it looks like this:

echo "password" | userdbpw | userdb "username " set imappw

Hawkpaul

Thanks to bwkaz (a moderator at JustLinux.com forums)
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
In courier-imap imapd.pem file is not been able to create manish_2479 Linux - Networking 1 10-03-2007 07:25 PM
courier-imap and/var/mail esteeven Linux - Networking 2 06-09-2005 05:25 PM
courier-imap cannot see mail davidsrsb Linux - Software 3 06-09-2005 10:14 AM
Postfix+Courier-IMAP virtual user not found when sending mail hawkpaul Linux - Software 0 05-03-2004 12:02 PM
courier imap, shadow passwords and mail directorys andzerger Linux - Networking 0 03-09-2004 10:31 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 08:07 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration