Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 14 Jul 2002 14:32:35 -0500
From:      Dan Nelson <dnelson@allantgroup.com>
To:        uwi mAn <uwiman3k@hotmail.com>
Cc:        questions@FreeBSD.ORG
Subject:   Re: weird things happening here
Message-ID:  <20020714193235.GE63064@dan.emsphone.com>
In-Reply-To: <F142k51EAJJ8jO5TeZ5000109a7@hotmail.com>
References:  <F142k51EAJJ8jO5TeZ5000109a7@hotmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
In the last episode (Jul 14), uwi mAn said:
> uwiman* pwd && id
> /usr/stuff/3/packages/All
> uid=0(root) gid=0(wheel) groups=0(wheel), 2(kmem), 3(sys), 4(tty), 
> 5(operator), 20(staff), 31(guest)
> uwiman* cp drm-kmod-0.9.5_1.tgz test | exec mkdir test
> mkdir: test: File exists
> uwiman# id
> uid=777(uwiman) gid=0(wheel) groups=0(wheel)
> uwiman#
> 
> 
> uwiman* cp drm-kmod-0.9.5_1.tgz | exec mkdir test
> usage: cp [-R [-H | -L | -P]] [-f | -i] [-pv] src target
>       cp [-R [-H | -L | -P]] [-f | -i] [-pv] src1 ... srcN directory
> uwiman# id
> uid=777(uwiman) gid=0(wheel) groups=0(wheel)
> uwiman#
> 
> As you might have already noticed, me [root] suddenly becomes a regular 
> mortal [user]. Why?

Because you probably became root by running "su", right?  The "exec
mkdir test" command tells the shell to exec() mkdir, which means that
the shell process disappears and is replaced by mkdir.  When mkdir
exits, control returns to the parent process (i.e. the shell you ran su
from).  Try logging in as root from a console screen and try the same
commands.

-- 
	Dan Nelson
	dnelson@allantgroup.com

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-questions" in the body of the message




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