Skip to main content
Question

Script to request username and password


Forum|alt.badge.img+9

Hi all.

I'm looking for a script that requests the user to input his username and password. If possible the user should type the password twice and both should be compared.

Both values should be stored for a later local account creation e.g.

Does somebody have something at hand?

5 replies

Forum|alt.badge.img+10
  • Contributor
  • 126 replies
  • April 24, 2018

Wouldn't this cause the users username and password to be sent in plain text. I am not sure that you really should do that. I would check with you network security team first.


Forum|alt.badge.img+10
  • Contributor
  • 126 replies
  • April 24, 2018

You could use something along the lines of...

#!/bin/sh

Username ="$(osascript -e 'Tell application "System Events" to display dialog "Enter your username:" default answer ""' -e 'text returned of result' 2>/dev/null)"

Password="$(osascript -e 'Tell application "System Events" to display dialog "Enter your password:" default answer ""' -e 'text returned of result' 2>/dev/null)"

Password2="$(osascript -e 'Tell application "System Events" to display dialog "Enter your password again:" default answer ""' -e 'text returned of result' 2>/dev/null)"

Then you would need add in the script how you want to output said answers. In the log? In a text file?

With that said this will send the information in plaintext and I highly suggest to NOT do that.


Forum|alt.badge.img+11
  • Valued Contributor
  • 165 replies
  • April 24, 2018

Without knowing your situation or what you've researched so far - have you looked into NoMAD Login?

NoMADLogin-AD


Forum|alt.badge.img
  • New Contributor
  • 1 reply
  • April 24, 2018

This script has a similar method as already posted, and also uses the "hidden answer" option and passes it to an expect block for later use. As @ammonsc mentioned, you'd definitely want to make sure this meets your security requirements:

https://github.com/JAMFSupport/FileVault2_Scripts/blob/master/reissueKey.sh


Forum|alt.badge.img+9
  • Author
  • Valued Contributor
  • 99 replies
  • April 25, 2018

Thanks all...
I'm aware of the password been passed in plain text or been used within the script in plain text.
We might look into another option to do this.


Reply


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings