Path: utzoo!attcan!uunet!tut.cis.ohio-state.edu!dsac.dla.mil!dsacg3.dsac.dla.mil!nts0302 From: nts0302@dsacg3.dsac.dla.mil (Bob Fisher) Newsgroups: comp.unix.questions Subject: Re: passwd file maint utilities - shadowing Message-ID: <1936@dsacg3.dsac.dla.mil> Date: 12 Mar 90 13:22:26 GMT References: <1990Mar8.183921.666@tcsc3b2.tcsc.com> Distribution: na Organization: Defense Logistics Agency Systems Automation Center, Columbus Lines: 30 From article <1990Mar8.183921.666@tcsc3b2.tcsc.com>, by pag@tcsc3b2.tcsc.com (Philip A. Gross): | aland@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@dsac.dla.mil osu-cis!dsacg1!bfisher