Subject: RE: Changing user passwd thru a program
To: Sumeet Malhotra <smalhotra@rhapsodynetworks.com>
From: Jeremy C. Reed <reed@reedmedia.net>
List: netbsd-users
Date: 04/17/2002 11:03:56
On Wed, 17 Apr 2002, Sumeet Malhotra wrote:

> I ran the program as root and it passes that point now! But was wondering
> how does the passwd program change its effective uid to 0. setuid (or
> seteuid) to 0 can only be done if you are a super user. Am I right?

passwd(1) doesn't change it itself.

$ ls -l `which passwd`
-r-sr-xr-x  2 root  wheel  16096 Mar 16 17:44 /usr/bin/passwd

Notice that it is setuid (set-user-ID-on-execution) so it runs as root.

   Jeremy C. Reed
   http://www.reedmedia.net/