Hi all,

I want to setup qmail-ldap with maildirs different from the users'
homedirs - homes should be /home/user, the maildirs should be
/var/qmail/maildirs/u/user. 

I've made a script to automatically create the ~. If I just run the
script (as root or as a normal user, e.g. vmail) the user is looked up
in ldap, the homedirectory is created and permissions are changed as
needed. But if I try to run 'echo to: [EMAIL PROTECTED] |
/var/qmail/bin/qmail-inject' and let the homedir be created
automatically it does only work half-ways: The directory is created and
chowned correctly, but chmod does not seem to work, thus I get an error.

Files are as follows:
=====================

host:/var/qmail/control# cat dirmaker
/var/qmail/bin/dirmaker.sh

host:/var/qmail/bin# ls -la dirmaker.sh
-rwxr-xr-x  1 root root 462 Dec 17 15:19 dirmaker.sh

host:/var/qmail/bin# ls -la makehome
-rwsr-xr-x  1 root root 8807 Dec 20 15:14 makehome
(makehome is a little c-program that creates the dir and does the
chmod/chown)

host:/var/qmail/bin# cat dirmaker.sh
set -x
id
DMLOG=/tmp/dirmaker.log
if [ ! -d $1 ]; then
        /usr/bin/ldapsearch -LLL "(homeDirectory=$1)" \
                uidNumber gidNumber -x -H ldaps://host.company.com -Z \         
        >
/tmp/uid.ldif
        /bin/grep '^uidNumber:' /tmp/uid.ldif | awk '{ print $2 }' \
                > /tmp/uid.txt
        /bin/grep '^gidNumber:' /tmp/uid.ldif | awk '{ print $2 }' \
                > /tmp/gid.txt
        /var/qmail/bin/makehome $1 `cat /tmp/uid.txt` \
                `cat /tmp/gid.txt` -v
        rm /tmp/uid.ldif /tmp/uid.txt /tmp/gid.txt
fi

from the logfile:
=================
Dec 21 10:21:39 sauron qmail: 1103624499.574030 delivery 120: deferral:
+_id/uid=11184(vmail)_gid=2110(vmail)_groups=2110(vmail)/
[snip]
+_/var/qmail/bin/makehome_/home/nber_1062_1000_-v/
My_id:_11184/
My_eid:_0/
Creating_directory_/home/nber/
/home/nber_created_successfully/
Stats_for_/home/nber/
perms:_700/
uid:_0/
gid:_2110/
chown_of_/home/nber_to_1062:1000_successfully/
Stats_for_/home/nber/
perms:_700/
uid:_1062/
gid:_1000/
+_rm_/tmp/uid.ldif_/tmp/uid.txt_/tm
Dec 21 10:21:39 sauron qmail:
1103624499.574030+p/gid.txt/Unable_to_switch_to_/home/nber:_access_denied._(#4.3.0)/

The thing is, in the makehome program is speciefied that the directory
shall be created with 755 (else the vmail user doesn't have read access
- would 711 also be possible?), but effective it is created with 700 and
not chowned properly (although setuid).

Any hints for me?
Thanks :)

-- 
Nora Bernhard
Systems Administrator - Linux

An expert is a person who avoids the small errors as he sweeps on to the
grand fallacy.
                -- Benjamin Stolberg

Attachment: signature.asc
Description: This is a digitally signed message part

Reply via email to