Changing passwords in Scripts

Duncan McEwan duncan at comp.vuw.ac.nz
Wed Feb 20 13:48:16 AEST 1991


In article <39 at cheops.UUCP> logier at cheops.UUCP (Rob Logie) writes:
>I live in a country where "crypt" is not avaliable (To my knowedge)

I think you will find that crypt(3) is available in Australia.  
It certainly is in NZ and we are subject to the same export regulations.
Whether it is a real DES based crypt or something else I don't know*, but it
should certainly be the same routine that your system uses to encrypt
users passwords (otherwise how would passwd(1) do it?).

If you want to be sure, try compiling and running the following.  Type
your clear text password when prompted, (just make sure noone is looking
over your shoulder at the time :-) and the first two characters of your
password from /etc/passwd when asked for the salt -- the result it prints
should be the same as your passwd entry.

--- cut here ---

char passwd[10], salt[5];
char *crypt();

main()
{
	printf("passwd? ");
	scanf("%8s", passwd);
	printf("salt? ");
	scanf("%2s", salt);
	printf ("encrypted password is %s\n", crypt(passwd, salt));
}

--- cut here as well ---

* I believe the restriction prevents export of the DES algorithm from the
  US whereas the crypt(3) routine implements a "modified" DES and so is
  not covered, but am open to correction on this.

--

Duncan



More information about the Comp.unix.admin mailing list