openpty && security server

hi, I am using the openpty function in my code to run an interactive command, for example, "hdiutil convert -format UDRO /tmp/myFileName.sparsebundle -o ./test". The file myFileName.sparsebundle is an encrypted disk with a password. When running this command, it triggers the security server and a password input dialog box pops up. I don't want this dialog box to appear, and I want to provide the password through the fd_master returned by openpty. How can I achieve this?

Pseudo terminals are a tricky, especially for tasks like this. Fortunately, most command-line tools that take passwords have an alternative means to supply that password. In the case of hdiutil, that’s the -stdinpass. See the hdiutil man page for the details.

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

openpty && security server
 
 
Q