# change password with do shell script



## floris (Feb 6, 2004)

What I would like to do:

change the realname & password of a machine in a simple way with applescript.

applescript:

display dialog "Your name?" default answer ""
set STNR to the text returned of the result
display dialog "Password?" default answer ""
set pass to the text returned of the result

do shell script "nicl / -create /users/student realname " & STNR & "" 

This changes the realname of the mac, is there a way to change the password? I tried using nicl and passwd but this doesn't seem to work.
The only interaction I want is the dialogbox!

suggestions?


----------



## scruffy (Feb 11, 2004)

the unix password changing command is "passwd".  Normal use is interactive, and it gets you to enter your password twice to make sure they match (incidentally, you probably should do this in your Applescript, lest a typo lock you out of your account).  However, read the man page, there might well be a non-interactive way of calling the command.

Also, are you sure the nicl call wouldn't be endlessly creating duplicate users called student, rather than modifying the one existing one?  Might be good to look into.


----------

