Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 06 Oct 1996 14:36:27 -0700
From:      Amancio Hasty <hasty@rah.star-gate.com>
To:        Robert Eckardt <roberte@mep.ruhr-uni-bochum.de>
Cc:        joerg_wunsch@uriah.heep.sax.de, freebsd-hackers@freebsd.org
Subject:   Re: su problem 
Message-ID:  <199610062136.OAA00365@rah.star-gate.com>
In-Reply-To: Your message of "Sun, 06 Oct 1996 23:15:15 %2B0200." <199610062115.XAA01101@ghost.mep.ruhr-uni-bochum.de> 

next in thread | previous in thread | raw e-mail | index | archive | help
>From The Desk Of Robert Eckardt :
> > > su -l hasty <shell>
> > > 
> > > 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 "<something>"
> 
> 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





Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199610062136.OAA00365>