[1544] in linux-net channel archive

home help back first fref pref prev next nref lref last post

Re: Smail 3.1.29.1: directory permission problems

daemon@ATHENA.MIT.EDU (H. Peter Anvin)
Fri Dec 22 05:29:26 1995

To: submit-linux-dev-net@ratatosk.yggdrasil.com
From: hpa@freya.yggdrasil.com (H. Peter Anvin)
Date: 21 Dec 1995 03:48:45 GMT
Reply-To: hpa@storm.net (H. Peter Anvin)

Followup to:  <m0tSDuG-000CAkC@gratis.xgroup.ernet.in>
By author:    raju@gratis.xgroup.ernet.in (Raj Mathur)
In newsgroup: linux.dev.net
>=20
> If you create a new user on the system, that user cannot receive mail
> until you manually create an empty mail file for him/her with the
> proper permissions. The issue seems to be that Smail cannot create
> files in the mail spool directory (/var/spool/mail on my system) since
> it sets it's UID and GID to that of the mail receiver before trying to
> open the file (with O_CREAT set).
>=20
> The mail directory is mode 775, owner root, group mail. Smail is
> setuid root, of course.
>=20
> While not averse to hacking Smail to get the right behaviour, I would
> like to know if anyone else has seen (or better, fixed!) this problem.
>=20

Pardon a dumb question, but what's wrong with creating a mail file at
account creation time?  On one syste, I use the following script to
create accounts:

!/bin/sh
#
# Script to add a new user
#

home=3D/home
mail=3D/usr/spool/mail
defshell=3D/bin/tcsh

echo -n 'User ID: '
read uid

echo -n 'Username: '
read uname

echo -n 'Full name: '
read fname

echo -n 'Main group: '
read group

echo -n 'Supplementary groups: '
read supgrp

if [ "x$supgrp" !=3D "x" ]; then
        supgrp=3D"-G $supgrp"
fi

echo -n "Shell: [$defshell] "
read shell

if [ "x$shell" =3D "x" ]; then
        shell=3D$defshell
fi

echo "Creating user $uname ($uid) with home directory $home/$uname"
echo "mail file $mail/$uname and shell $shell"

/etc/useradd -u $uid -g $group $supgrp -d $home/$uname -s $shell $uname
mkdir $home/$uname
chown $uname.$group $home/$uname

if [ $group =3D "nueml" ]; then
        mode=3D751
else
        mode=3D711
fi

chmod $mode $home/$uname

touch $mail/$uname
chown $uname.mail $mail/$uname
chmod 660 $mail/$uname

chfn -f "$fname" $uname

passwd $uname

--=20
PGP public key available - finger hpa@terminus.storm.net
"The earth is but one country, and mankind its citizens."  --  Bah=E1'u'l=
l=E1h
I don't work for Yggdrasil, but they sponsor the linux.* hierarchy.

home help back first fref pref prev next nref lref last post