NetBSD Problem Report #37288

From martin@duskware.de  Tue Nov  6 09:50:47 2007
Return-Path: <martin@duskware.de>
Received: from mail.netbsd.org (mail.netbsd.org [204.152.190.11])
	by narn.NetBSD.org (Postfix) with ESMTP id 63FC363BA5F
	for <gnats-bugs@gnats.netbsd.org>; Tue,  6 Nov 2007 09:50:47 +0000 (UTC)
Message-Id: <20071106094647.502E263BA4A@narn.NetBSD.org>
Date: Tue,  6 Nov 2007 09:46:47 +0000 (UTC)
From: arto.huusko@pp2.inet.fi
Reply-To: arto.huusko@pp2.inet.fi
To: netbsd-bugs-owner@NetBSD.org
Subject: su fails if home on nfs without root privileges
X-Send-Pr-Version: www-1.0

>Number:         37288
>Category:       bin
>Synopsis:       su fails if home on nfs without root privileges
>Confidential:   no
>Severity:       serious
>Priority:       high
>Responsible:    bin-bug-people
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Tue Nov 06 09:55:00 +0000 2007
>Originator:     Arto Huusko
>Release:        4.99.34
>Organization:
>Environment:
NetBSD wmli019400.local 4.99.34 NetBSD 4.99.34 (DUUNI) #33: Mon Nov  5 12:34:59 EET 2007
>Description:
su fails with output

su: no directory

when home directory of the target user is on an NFS mount, and the NFS server does not grant special privileges for root user of NFS clients.

This is because su apparently does the chdir to target user's home directory as root.

Amusing (not) effects of this are, for example, that user can't su to self, root can't su to the user, etc.
>How-To-Repeat:
$ whoami
huuskart
$ pwd
/koti/home/huuskart
$ ls -ld .
drwx------  51 huuskart  medi  4096 Nov  6 11:41 .
$ mount
...
nfsserver:/home on /koti/home type nfs
...
$ su - huuskart
su: no directory
$ su -     
Password:
# cd /koti/home/huuskart/
cd: can't cd to /koti/home/huuskart/
# su - huuskart
su: no directory

>Fix:
Change su to do the chdir to target user's home directory as the target user, not root.

It would not hurt to change the no directory error report to use err() instead of errx() so that reason of the error is also shown.

NetBSD Home
NetBSD PR Database Search

(Contact us) $NetBSD: query-full-pr,v 1.39 2013/11/01 18:47:49 spz Exp $
$NetBSD: gnats_config.sh,v 1.8 2006/05/07 09:23:38 tsutsui Exp $
Copyright © 1994-2007 The NetBSD Foundation, Inc. ALL RIGHTS RESERVED.