*BSD News Article 66437


Return to BSD News archive

Path: euryale.cc.adfa.oz.au!newshost.anu.edu.au!harbinger.cc.monash.edu.au!news.rmit.EDU.AU!news.unimelb.EDU.AU!munnari.OZ.AU!news.hawaii.edu!ames!usenet.kornet.nm.kr!news.kreonet.re.kr!usenet.seri.re.kr!news.cais.net!van-bc!van-bc!not-for-mail
From: jhenders@wimsey.com (John Henders)
Newsgroups: comp.unix.bsd.freebsd.misc
Subject: Re: No su -c
Date: 19 Apr 1996 15:14:15 -0700
Organization: Wimsey Information Services
Lines: 41
Message-ID: <4l937n$smu@vanbc.wimsey.com>
References: <1436504362@f401.n711.z3.ftn> <4l83sb$65i@uriah.heep.sax.de>
NNTP-Posting-Host: vanbc.wimsey.com
X-Newsreader: NN version 6.5.0 #3 (NOV)

In <4l83sb$65i@uriah.heep.sax.de> j@uriah.heep.sax.de (J Wunsch) writes:

>`-c' is an option to the invoked shell, not to the `su' utility.
>Therefore, the optional user id is no longer optional if you wanna use
>-c.

It doesn't appear to work even when used properly. Note root's shell is
bash here but I get identical results with /bin/sh, so it's not a shell
issue. Also note I have gnu su first in my path to overcome this
problem.

FreeBSD is the first unix I've used where su user -c didn't work.

Script started, output file is typescript
# export PS1='`whoami` \$'
root #su news -c id
uid=10(news) gid=8(news) groups=8(news), 0(wheel)
root #/usr/bin/su news -c id
`whoami` \$echo $SHELL
/bin/sh
`whoami` \$id
uid=10(news) gid=8(news) groups=8(news), 0(wheel)
`whoami` \$exit
root #exit
Script done, output file is typescript
# cat typescript
Script started on Fri Apr 19 15:08:38 1996
# export PS1='`whoami` \$'
root #su news -c id		<- gnu su
uid=10(news) gid=8(news) groups=8(news), 0(wheel)
root #/usr/bin/su news -c id	<- FreeBSD su
`whoami` \$echo $SHELL
/bin/sh
`whoami` \$id
uid=10(news) gid=8(news) groups=8(news), 0(wheel)
`whoami` \$exit
root #exit

Script done on Fri Apr 19 15:10:01 1996
-- 
i* - The internet provider formerly know as Wimsey