Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!helios!tamuts.tamu.edu From: packman@tamuts.tamu.edu (Wally Strzelec) Newsgroups: comp.unix.wizards Subject: Password Pipe Message-ID: <13766@helios.TAMU.EDU> Date: 26 Mar 91 18:50:09 GMT Sender: usenet@helios.TAMU.EDU Organization: Texas A&M University Lines: 41 Howdy.... I am writing a short program that will allow me to change the password on a remote machine. To do this I am trying to use popen and feed it the "/etc/passwd" command on the remote machine. The problem is that it seems that the passwd command doesn't accept anything that I send down the pipe. Can someone please tell me where I am messing up. The following is my test: #include main (argc, argv) int argc; char *argv[]; { char line[25], pass[9], user[9]; FILE *pi, *popen(); strcpy(user, argv[1]); strcpy(pass, argv[2]); printf("%s %s\n", user, pass); sprintf(line, "/bin/passwd %s ", user); pi = popen(line, "w"); if(!pi) { exit(1); } fprintf(pi, "%s\n", pass); fprintf(pi, "%s\n", pass); pclose(pi); exit(0); } Thanks.... Wally Strzelec Texas A&M University Unix System Administrator packman@tamuts.tamu.edu These are my own opinions and do not necessarily reflect those of Texas A&M University.