1832995 Members
2404 Online
110048 Solutions
New Discussion

Here Document

 
Tariq Khan_1
Occasional Contributor

Here Document

I have a simple script to change/update the user password using here document. Apparently it don't seems to work. Here is the text of the script

#########################
#!/usr/bin/ksh

##tst.sh

passwd usrname<test123
test123
END

#####################

Any help would be appreciated

tmk
3 REPLIES 3

Re: Here Document

And it won't with passwd - passwd won't talk to anything but a tty.

To acheive this your going to need something like expect:

http://hpux.connect.org.uk/hppd/hpux/Tcl/expect-5.39/

HTH

Duncan

I am an HPE Employee
Accept or Kudo
Hoefnix
Honored Contributor

Re: Here Document

Hi,
Like mentioned in the previous post. It won't work.

What you can do is overwrite the encrypted string with a new encrypted string in the /etc/passwd file or in the /tcb/..... password files if it's a trusted system.

HTH
Peter Geluk

Chris Vail
Honored Contributor

Re: Here Document

This is horribly unsecure! Don't do it! The others mentioned how to use expect to script this, but please reconsider. This just isn't good systems administration practice. Any user who is incapable of typing "passwd" is also going to be incapable of running your expect script.


Chris