Subject: Re: login troubles
To: Mathias Band <05.08@web.de>
From: Woodchuck <djv@bedford.net>
List: netbsd-help
Date: 02/23/2007 15:54:21
On Thu, 22 Feb 2007, Mathias Band wrote:

> Greetings netbsd-help subscribers!
> 
> I recently installed NetBSD 3.1 on an i386 desktop machine.
> Login as root is no problem but when logging in as normal
> users (from console) I always get the message
> "No home directory [homedirectory]!" and login is refused.
> Permission are set correctly.. I really can't find the mistake.
> I tried creating /etc/login.conf too.. But it didn't work out..
> Even su from root shell refuses user login: "/bin/sh: Permission
> denied." (Even though the permissions shouldn't be the
> problem..)

Somehow, the permissions aren't right.  This is the source code
for this problem from /usr/src/usr.bin/login/login.c

    570         if (chdir(pwd->pw_dir) < 0) {
    571 #ifdef LOGIN_CAP
    572                 if (login_getcapbool(lc, "requirehome", 0)) {
    573                         (void)printf("Home directory %s required\n",
    574                             pwd->pw_dir);
    575                         sleepexit(1);
    576                 }
    577 #endif
    578                 (void)printf("No home directory %s!\n", pwd->pw_dir);
    579                 if (chdir("/"))
    580                         exit(0);
    581                 pwd->pw_dir = "/";
    582                 (void)printf("Logging in with home = \"/\".\n");
    583         }


LOGIN_CAP is true for the default system.  Your error message is
coming from line 578.  Notice that the next thing that happens is
an attempt to cd to /.  If that fails, it fails silently.  
I suspect that this is happening, otherwise you would have seen
the "Logging in with home = "/"" message.

Check your permissions on "/" and each component of the path to
user's home directory.  Change them to 755 unless you know better.

User's home directory should be owned by user (unless you know
better, i.e. some special case). 755 is also appropriate permissions
for user's home in the usual case.

I suspect you'll find your permissions on / or /home are bogus.

I also suspect your errors from the "su user" (you don't specify
the command exactly, so this is a guess) case come from something
that the su was doing *after* if changed its euid to user's.

Please let me know how this works out.

> Can anyone give me a hint, what the reason for this might
> be?
> And besides isn't there a default login.conf for NetBSD?

There appears to be none.  There probably should be one to serve
as a starting point.

Dave