Computing.Net > Forums > OpenVMS > Change Password in DCL

Computer Problems? Computing.Net has over 1,000,000 posts about all things technology related! Over 90% answered within 24 hours! Click here to start participating now! Also, be sure to check out the New User Guide.

Change Password in DCL

Reply to Message Icon

Name: lernen.2007
Date: September 22, 2008 at 08:29:07 Pacific
OS: Windows
CPU/Ram: AMD
Comment:

Hello,

how can I change by a DCL-File the password?

Thanks



Sponsored Link
Ads by Google

Response Number 1
Name: Joseph.Huber
Date: September 24, 2008 at 02:25:30 Pacific
Reply:

The simplest way is:
$ SET PASSWORD
oldpassword
newpassword
newpassword

But You certainly don't want to put passwords in a file.

What is the purpose of Your question ?
If it is just to call SET PASSWORD out of some (menu-)command-file, then first do a noecho read from the terminal of the old andf new password, then put that into a temporary file with the above SET PASSWORD command:

$set terminal/noecho
$read/error=done/end=done/prompt="Old PW" sys$command oldpw
$read/error=done/end=done/prompt="New PW" sys$command newpw
$open/write t sys$scratch:xxxyyy.tmp
$ write t "$SET PASSWORD"
$ write t oldpw
$ write t newpw
$ write t newpw
$ write t "$ EXIT"
$ close t
$ set noon
$@sys$scratch:xxxyyy.tmp
$ delete sys$scratch:xxxyyy.tmp;
$DONE:
$ set terminal/echo

(The above probably doesn't catch all error-cases).

Now if the purpose is to unconditionally (re)set the password of another user (in a help-desk script ?), then it is simply a one liner:
$ MCR AUTHORIZE modify 'user' /password='password'

where the two symbols user and password have been defined before.


0

Response Number 2
Name: Bob Gezelter (by gezelterr)
Date: November 12, 2008 at 05:52:03 Pacific
Reply:

Joseph,

With all due respect, the command file leaves the data from its execution on the disk. If this must be done, I strongly suggest the use of DELETE/ERASE to erase the blocks BEFORE the space is returned to the free space.

- Bob Gezelter, http://www.rlgsc.com


0

Response Number 3
Name: Joseph.Huber
Date: November 18, 2008 at 05:05:54 Pacific
Reply:

You mean replace in my quick hack example:
delete sys$scratch:xxxyyy.tmp;
by
delete/erase sys$scratch:xxxyyy.tmp;

There are other (error-)situations to catch, and with recent (>=6.2) VMS, PIPE can be used to avoid temporary files at all (the posters OS is apparently windows, so I don't know the VMS version :-).

Anyway I never used and do not recommand to set passwords out of a command file, and the few lines just demonstrate the principle how to solve the question asked.

Joseph Huber, http://www.huber-joseph.de


0

Response Number 4
Name: bradleybee
Date: March 13, 2009 at 10:05:26 Pacific
Reply:

Could someone help me? I'm not a real programmer, but I can understand the code above. Could I add a few lines of code after this line...

$read/error=done/end=done/prompt="New PW" sys$command newpw

...to force alpha-numeric passwords and refuse alpha-only and numeric-only passwords? Something like:

$ pw_num=f$extract(something)
$ if pw_num .nes. "" then goto pw_cont_a
$ WRITE SYS$OUTPUT "password must contain at least one number"
$ goto set_pass
$pw_cont_a:
$ pw_alp=f$extract(something)
$ if pw_alp .nes. "" then goto pw_cont
$ WRITE SYS$OUTPUT "password must contain at least one letter"
$ goto set_pass
$pw_cont:

Am I on the right track or out in left field? Thanks for any info...


0

Response Number 5
Name: Joseph.Huber
Date: March 13, 2009 at 11:17:24 Pacific
Reply:

You can't test for something with a single f$extract, but in a loop, best written as a subroutine.
Example for testing if a string contains a number:

$TESTNUM: SUBROUTINE
$ x=p1
$ L=f$length(x) - 1
$ num="0123456789"
$ n=0
$loop:
$ t=f$extract(L,1,x)
$ isnum=F$locate(t,num)
$ if isnum.lt.f$length(num) then n=n + 1
$ L = L - 1
$ if L.ge.0 then goto loop
$ if n.eq.0
$ then write sys$output x," contains no numbers."
$ else write sys$output x," contains ",n," numbers."
$ 'p2'==n
$ EXIT
$ ENDSUBROUTINE !End of subroutine testnum
$!
$ CALL TESTNUM "abc123def" N
$ write sys$output "testnum returned N=",N

A similar subroutine for testing if it contains alpha or special characters like "_$" is left as an exercise to You.

Joseph Huber, http://www.huber-joseph.de
ITRC


0

Related Posts

See More



Response Number 6
Name: Joseph.Huber
Date: March 13, 2009 at 11:52:54 Pacific
Reply:

And BTW, why do this in a procedure using DCL input, why not just do a SET PASSWORD ?
Together with a "password policy" module, which does all this checks ?
See the discussion in
http://forums11.itrc.hp.com/service...

which has pointers to a password policy module doing exactly that.
A password policy module works also for users doing a "SET PASSWORD" directly from the command-line, not only from Your command-file.

Joseph Huber, http://www.huber-joseph.de
ITRC


0

Response Number 7
Name: bradleybee
Date: March 13, 2009 at 13:24:20 Pacific
Reply:

Thanks for the tip!!!


0

Sponsored Link
Ads by Google
Reply to Message Icon





Use following form to reply to current message:

Login or Register to Reply
LoginRegister


Sponsored links

Ads by Google


Results for: Change Password in DCL

changing chars in a file from DCL www.computing.net/answers/openvms/changing-chars-in-a-file-from-dcl/529.html

sql in command script??? www.computing.net/answers/openvms/sql-in-command-script/381.html

How to change VMS password through www.computing.net/answers/openvms/how-to-change-vms-password-through-/454.html