[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: problems creating users



Sorry for my long respond period and my short answer. I have a lot of
schoolwork to do :(
On Mon, Jun 04, 2001 at 09:32:29AM -0400, Dave VanAuken wrote:
> 
> We add users with a form/PHP entry into database.
> If the entry is "alias" and virtual_host variable is a new variable,
> it
> 	- adds it to the locals table in the db
> 	- creates /usr/mail/$virtual_host directory with chmod 0770
> (result drwxrwx---  3 nobody  mailusers  512 Jun  4 05:36
> nexusisp.com)
> 	- adds the alias entry into the passwd table
> 
> *Q1: At what point in time does sqlcreatehomedir add the maildir files
> for the alias user?
Each time a program calls qmail-getpw. That's mostly qmail-lspawn, who
tries to deliver a local mail. In your case, sqlcreatehomedir won't be
called, since qmail-getpw detects an existing homedir.
> 
> We then add user david...
> 
> *Q2 are the uid and gid entried for the passwd table supposed to be
> uid and gid entries in /etc/passwd? or are they used internally for
> database only?
General answer: only internally to the database. Real-world: perhaps you
have some shell-users on your system who read their mail on the server.
Their uid/gid has to match with the ones in the database.

> 
> ...currently setting random or selected uid and gid, set password,
> default the others...
> 
> Then we go to test the newly created user
> 
> nx1# /var/qmail/bin/qmail-getpw david nexusisp.com ; $?
> david21/usr/mail/nexusisp.com/david00: Command not found.
> 
> It appears that it gets to the stage of trying to run sqlcreatehomedir
> and runs into problems
Try echo $?
$? is an exit-status: it's a small integer and you don't want to execute
that: you want it's value. 
> 
> End result is
> 	drwx------  2 operator  daemon  512 Jun  4 05:36 david
> in the appropriate /usr/mail/$virtual_host directory
> there are no maildir/qmail files in this directory.
Are you sure that directory didn't exist before ? Try to delete it and
then run /var/qmail/bin/qmail-getpw david nexusisp.com. If that still
didn't create a Maildir, sqlcreatehomedir is indeed failing.
Note that you're running sqlcreatehomedir as root: normay it runs as
qmaill. So after running qmail-getpw: delete the dir and try to deliver a
local mail (echo hi | mail david@xxxxxxxxxxxx).
> 
> 
> not sure why this is failing, and would also like to clarify the
> following:
> 
> 1) if all new virtual_hosts that are going to be serviced locally are
> entered into the locals db table, when to any actual changes need to
> take place in the /etc/passwd file, or /var/qmail/control/locals file
Sorry, i don't understand the question.
> 
> 2) Whenever we need to add users/domains to this mail server, we need
> only add a alias entry in the passwd table, and a domain name in the
> locals table, create a directory in our /usr/mail tree matching the
> domain name for the program to dump user subdirectories for that
> domain name, and its a done deal?
Almost everybody seems to misunderstand the meaning of "localtable". 
All domains in that table are served from the passwd-file: the database is
NOT USED for that domains.  The table has nothing to do with 
/var/qmail/control/locals.
If you want to add a new domain:
- create user alias and make sure the parentdir exists (eg /usr/mail) or
  sqlcreatehomedir will fail
- if you have /var/qmail/control/rcpthosts: add your domain to that file. If
  the file doesn't exist, you will server all possible domains
- if you have /var/qmail/control/locals, add your domain to that file. If the
  file doesn't exist, qmail-send will build it internally by running a select
  distinct virtual_host from passwd.
- all other users: put their values in the database and make sure their
  parentdir exists too. In my setup, each virtual domain has his own dir
  (created manually) and all users have a subdir within that dir (created
  manually too ... users are created with a webinterface, which also takes
  care of their homedir - i don't use sqlcreatehomedir anymore).

> 
> 
> 
> here are info files about the setup
Your alias-user (database) is wrong: it doesn't have a homedir. 
You've defined a localtable, but does that table exists in the database too ?

Kindly regards,
Michael Devogelaere.

> -- in /etc/passwd --
> alias:*:81:81:User &:/var/qmail/alias:/nonexistent
> qmaill:*:83:81:User &:/var/qmail:/nonexistent
> qmaild:*:82:81:User &:/var/qmail:/nonexistent
> qmailp:*:84:81:User &:/var/qmail:/nonexistent
> qmailq:*:85:82:User &:/var/qmail:/nonexistent
> qmailr:*:86:82:User &:/var/qmail:/nonexistent
> qmails:*:87:82:User &:/var/qmail:/nonexistent
> vpopmail:*:89:89:User &:/usr/local/vpopmail:/nonexistent
> virtual:*:1002:103:virtual:/home/mail:/nonexistent
> -- in /etc/passwd --
> 
> -- in /etc/group -- # using this as the "nofiles" group
> mailusers:*:103:
> -- in /etc/group --
> 
> -- in /var/qmail/controls --
> -rw-r--r--  1 root    qmail       27 Jun  4 03:28 defaultdomain
> -rw-r--r--  1 root    qmail       73 Jun  4 03:28 locals
> -rw-r--r--  1 root    qmail       73 Jun  4 02:11 locals.bak
> -rw-r--r--  1 root    qmail       31 Jun  4 03:28 me
> -rw-r--r--  1 root    qmail       27 Jun  4 03:28 plusdomain
> -rw-r--r--  1 root    qmail       73 Jun  4 03:28 rcpthosts
> -r--r-----  1 qmails  mailusers  552 Jun  4 05:36 sqlserver
> -- in /var/qmail/controls --
> 
> -- in /var/qmail/controls/sqlserver --
> db_use yes
> check_host yes
> connectionstring host=localhost user=dbuser password=secret
> dbname=qmaildb
> popconnectionstring host=localhost user=dbuser password=secret
> dbname=qmaildb
> dbtable passwd
> autohomedir yes
> localtable locals
> virt_host_field _virtual_host
> login_field _login
> passwd_field _password
> home_field _home
> uid_field _uid
> gid_field _gid
> quota_field _hardquota
> enabled_field _enabled
> startdate_field _startdate
> stopdate_field _stopdate
> localpop nexusisp.com
> lastlogin_field lastlogin
> global_use yes
> global_domain nexusinternetsolutions.net
> -- in /var/qmail/controls/sqlserver --
> 
> -- in /usr/local/sbin --
> -rwsr-x---  1 root  mailusers   11988 Jun  3 20:06 sqlcreatehomedir
> -- in /usr/local/sbin --
> 
> -- in qmaildb / table passwd --
>  cpnum | _login | _uid | _gid |            _home             |
> _virtual_host | _
> password | _hardquota |       _startdate       | _stopdate | _enabled
> -------+--------+------+------+------------------------------+--------
> -------+--
> ---------+------------+------------------------+-----------+----------
>      1 | alias  |    1 |    1 |                              |
> nexusisp.com  |
>          |          0 | 2001-06-04 04:47:32-04 | infinity  | t
>      1 | david  |    2 |    1 | /usr/mail/nexusisp.com/david |
> nexusisp.com  | p
> assword  |          0 | 2001-06-04 04:55:34-04 | infinity  | t
> (2 rows)
> -- in qmaildb / table passwd --
> 
> anything else?
> 
> Dave
>