From owner-freebsd-hackers Sun Oct 6 14:36:58 1996 Return-Path: owner-hackers Received: (from root@localhost) by freefall.freebsd.org (8.7.5/8.7.3) id OAA12600 for hackers-outgoing; Sun, 6 Oct 1996 14:36:58 -0700 (PDT) Received: from rah.star-gate.com (rah.star-gate.com [204.188.121.18]) by freefall.freebsd.org (8.7.5/8.7.3) with ESMTP id OAA12592 for ; Sun, 6 Oct 1996 14:36:55 -0700 (PDT) Received: from rah.star-gate.com (localhost.star-gate.com [127.0.0.1]) by rah.star-gate.com (8.7.6/8.7.3) with ESMTP id OAA00365; Sun, 6 Oct 1996 14:36:28 -0700 (PDT) Message-Id: <199610062136.OAA00365@rah.star-gate.com> X-Mailer: exmh version 1.6.9 8/22/96 To: Robert Eckardt cc: joerg_wunsch@uriah.heep.sax.de, freebsd-hackers@freebsd.org Subject: Re: su problem In-reply-to: Your message of "Sun, 06 Oct 1996 23:15:15 +0200." <199610062115.XAA01101@ghost.mep.ruhr-uni-bochum.de> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Sun, 06 Oct 1996 14:36:27 -0700 From: Amancio Hasty Sender: owner-hackers@freebsd.org X-Loop: FreeBSD.org Precedence: bulk >From The Desk Of Robert Eckardt : > > > su -l hasty > > > > > > it gets a core dump... > > > > Analyze it. That's what coredumps are for. > > > > Are you sure that it's not actually > > > > su -l hasty -c "" > > It would be nice if this would work. > I was searching for that feature since the time I changed > from SysVr3.2 to FreeBSD. (And it's not in the manpage.) > > Is the missing ability to execute commands like sh BSD-specific > or a security precaution ? > > Robert Hi , The problem is easy . I just ran the debugger in rc.local and debugged su . What it show is that su does: p = getenv("TERM"); cleanenv[0] = NULL; environ = cleanenv; (void)setenv("PATH", _PATH_DEFPATH, 1); (void)setenv("TERM", p, 1); ^^^ p is NULL because TERM is not defined if (chdir(pwd->pw_dir) < 0) errx(1, "no directory"); } if (asthem || pwd->pw_uid) (void)setenv("USER", pwd->pw_name, 1); (void)setenv("HOME", pwd->pw_dir, 1); (void)setenv("SHELL", shell, 1); So I stuck in rc.local : HOME=/root GROUP=wheel SHELL=/bin/sh LOGNAME=root cd /root PWD=/root TERM=cons25 export TERM PWD HOME GROUP LOGNAME su -l hasty /usr/home/hasty/foo And now su works.... Someone should review "su.c". Thank you, Amancio