passwd file maint utilities - shadowing

Bob Fisher nts0302 at dsacg3.dsac.dla.mil
Mon Mar 12 23:22:26 AEST 1990


>From article <1990Mar8.183921.666 at tcsc3b2.tcsc.com>, by pag at tcsc3b2.tcsc.com (Philip A. Gross):
| aland at infmx.UUCP (Dr. Scump) writes:
| 
|>4) also, is there a way to *set* a passwd from a script?  /bin/passwd
|>   seems to insist on interactive use.  I can remove a passwd (via
|>   /bin/passwd -d username) but not set one, as far as I can see.
|>   I checked everywhere in TFM that I can think of.
| 
| You are correct.  To the best of my knowledge, the /bin/passwd command
| is the only tool available for setting user passwords and it requires
| user interaction.  I suppose that if you could figure out what the
| /bin/passwd command uses as its encryption key, you could write a 'C'
| program to handle this need.

On our BSD 4.3 system we have two functions to do this in C.  I would hope
that SystemV would have the same or similar.

	getpass(prompt) returns the in-the-clear password but takes care of
	no echo for the terminal.

	crypt(password, salt) receives the in-the-clear password and a
	salt value (based on some random value - process id, time, etc)
	and returns the encrypted value that can be inserted into the
	password file.

-- 
Bob Fisher
US Defense Logistics Agency Systems Automation Center
DSAC-TSX, Box 1605, Columbus, OH 43216-5002     614-238-9071 (AV 850-9071)
bfisher at dsac.dla.mil		osu-cis!dsacg1!bfisher



More information about the Comp.unix.questions mailing list