I want to script the use of passwd. Since it accesses the controlling tty directly, I cannot do this with standard IO redirection.

I may not install additional perl modules nor the expect utility.

I have written a perl script to do this but there is something missing. I think I need to do something to make the new tty the controlling terminal for the forked process but cannot find out what it is I need to do.

I posted my attempt as an attachement here
http://www.daniweb.com/techtalkforums/post251181-11.html
because one of the posters seemed to have done something similar.

This will ultimately be used to change the passwords on all servers in a network. Right now, to test, it should display what passwd writes to the tty and reply with what is input on the keyboard. The while loop is strictly utilitarian, designed for a testing.

Recommended Answers

All 2 Replies

I think I need to do something to make the new tty the controlling terminal for the forked process but cannot find out what it is I need to do.

I personally have no idea how to do that. If you get no answers here you may want to post on www.perlmonks.com

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.