Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9115783
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T04:30:53+00:00 2026-06-17T04:30:53+00:00

I am writing a script that prompts the logged in user for their password

  • 0

I am writing a script that prompts the logged in user for their password using CocoaDialog in order to initiate FileVault 2 encryption.

Ideally, I’d like to verify that the password is correct, but I haven’t found a good way to do so. I tried spawning /usr/libexec/chkpasswd via the subprocess module, but it seems to hit return before I can pass the password to stdin. (I just get “Sorry”, which is the stdout for a wrong password.)

I briefly looked at pexpect, but I’d like to do this without third party tools in order to keep deployment simple.

All Macs would be running OS X 10.8.2.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-17T04:30:54+00:00Added an answer on June 17, 2026 at 4:30 am

    A quick look around digs up this: the Darwin source for PAM authentication in chkpasswd. It looks like chkpasswd is using its own sub-TTY to get your password:

    /* Initialize PAM. */
    pamc.conv = &openpam_ttyconv;
    pam_start(progname, uname, &pamc, &pamh);
    
    printf("Checking password for %s.\n", uname);
    

    [and then more PAM specific code to see if the password works out.]

    This is good for security, but bad for you: there won’t be any way you can use I/O redirection to send over the password. Depending on how pexpect works, it might even not be able to do it: it might keep sending input to the TTY in which chkpasswd is running rather than to the sub-terminal. I don’t know enough about the wiring of each of those components to give a guess without testing it out.

    I know this doesn’t really solve your question, but I thought it would be worth noting.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm writing a script that asks the user for several options and then, via
I'm writing a script that will send user details to a PHP script via
I'm writing a script that (when the enter button is pressed) requires some user
I'm writing a script that will constantly scan iTunes for new dialog boxes and
I am writing a script that will look in a custom reports directory, copy
I am writing a script that checks if given domain is parked or not.
I'm writing a script that will ping my ip range. Here's what I have
I'm writing a script that'll read through my ftpd logs and generate a hash
I'm writing a script that is supposed to run around a bunch of servers
I'm writing a script that parses the pure-ftpwho -s command to get a list

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.