Shell Script keeps prompting for password after updating from Mojave to Catalina

After updating to Catalina my script continues to prompt for a password such as in the case of


do shell script "tmutil startbackup -b" password my_password with administrator privileges

or

do shell script "sudo pmset -c sleep 75" password my_password with administrator privileges


I'm passing a password from the keychain to the variable named "my_password". This worked fine using Mojave but is a challenge with Catalina where I'm prompted to enter a password. I know that variable "my_password" contains the correct password as I can display the text using "display alert my_password".


Your suggestions are appreciated.

Mac Pro

Posted on Nov 2, 2019 10:06 AM

Reply
Question marked as Top-ranking reply

Posted on Nov 18, 2019 5:14 PM

The user name needs to be passed along with the password.


In this example:

set userName to do shell script "whoami"


do shell script "tmutil startbackup -b" user name userName password my_password with administrator privileges


Similar questions

2 replies

Nov 2, 2019 11:41 AM in response to oNewton

Although I may be mistaken, I think it may be changes in how Catalina handles security issues. Putting a password in clear text wouldn't be recommended, so it's possible that Catalina no longer permits this. Or it could be the result of change in the default shell. Catalina does not use bash. Instead it uses zsh. Maybe the shell does not permit putting a clear text password into a file for use with the 'password' command.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Shell Script keeps prompting for password after updating from Mojave to Catalina

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.