Re: Interactive Commands

From: Date: Tue, 24 Oct 2000 17:08:26 +0000
Subject: Re: Interactive Commands
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-21801@lists.php.net to get a copy of this message
chpasswd is just something I made up, a command/script/program that I'd write if I was doing it a whole lot. TTY is a console connected to the machine. Most Un*x's will use "ptty" which are psudo-terminals - your machine which isn't physically connected to the machine but "virtually" connected via rsh, telnet, etc. passwd oldpass newpass doesn't work for the simple fact that passwd doesn't take command line parameters. Either create a zsh/csh/bash/tcsh/sh script called "chpasswd" and code the internals yourself to put them in the correct sequence, or... brick$ echo "oldpass\nnewpass\nnewpass | passwd" if you want to specify a user... brick$ echo "oldpass\nnewpass\nnewpass | passwd someuser" But to change someone else's pword you have to have root. =) -Szii At 07:25 PM 10/23/00 -0700, Mukul Sabharwal wrote: >Hi, > >Well... I telnet(ed) into my account.... as per >replies.... i tried chpasswd... not a valid function.. > >passwd oldpass newpass verify also doesn't work, for >the simple reason that \n needs to be there.... > >but i can't seem to get it right..... > >what's a TTY ? > >http://www.plesk.com ... Plesk does almost what I want >to do .. changing passwords, etc. though you need to >have control over the server in that case...but what >if i am the root.... how do i change the password... >which is just an example... how do i make it more >interactive ? > >thanks. > >> You may need to use special tricks to change >> passwords. Many password >> programs do not work if stdin is not a TTY (so you >> can't "echo" or pipe >> data into the program). This is considered a >> security feature. > >--- Szii <szii@sziisoft.com> wrote: > Because the >first is a separate process, you're >> going to have a >> difficult time with this. >> >> Under Un*x, you can "echo oldpass\nnewpass\n | >> passwd" >> and it'll work. =) Whatever happens, once you >> launch your >> new process, then you're not using passthru anymore, >> but >> need something more "inter-process." The Un*x >> "pipe" >> works well for this. For more complex things, I'd >> write a >> quick shell script/C program to do the passwd call >> and >> put parameters off of it. >> >> ie, passthru(chpasswd old new verify) >> >> 'Luck! >> >> -Szii >> >> At 10:22 PM 10/22/00 -0700, Mukul Sabharwal wrote: >> >Hi, >> > >> >I was recently doing useless stuff with System(), >> >Exec(), Passthru, etc... and was wondering if i >> could >> >change my password using this : >> > >> >I tried : >> > >> >echo "<pre>"; >> > >> >passthru("whois devhome.net"); >> > >> >echo </pre>"; >> > >> >this works fine, but i can't seem to get this right >> : >> > >> >echo "<pre>"; >> > >> >passthru("passwd\noldpass\nnewpass\nnewspass"); >> > >> >echo "</pre>"; >> > >> >why doesn't this work, i'm not very familiar with >> how >> >to do interactive stuff... and how can i read the >> >output and on that basis make my decision.... maybe >> if >> >it says password too easy... but still i'll keep on >> >doing that... >> > >> >thanks. >> > >> >===== >> >To Find Out More About Me : http://mukul.tsx.org/ >> > >> >__________________________________________________ >> >Do You Yahoo!? >> >Yahoo! Messenger - Talk while you surf! It's FREE. >> >http://im.yahoo.com/ >> > >> >-- >> >PHP General Mailing List (http://www.php.net/) >> >To unsubscribe, e-mail: >> php-general-unsubscribe@lists.php.net >> >For additional commands, e-mail: >> php-general-help@lists.php.net >> >To contact the list administrators, e-mail: >> php-list-admin@lists.php.net >> > > > >===== >To Find Out More About Me : http://mukul.tsx.org/ > >__________________________________________________ >Do You Yahoo!? >Yahoo! Messenger - Talk while you surf! It's FREE. >http://im.yahoo.com/ >

« previous php.general (#21801) next »