Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

osinstallersetupd wants admin credentials #74

Closed
maxm-ray opened this issue Oct 9, 2018 · 45 comments
Closed

osinstallersetupd wants admin credentials #74

maxm-ray opened this issue Oct 9, 2018 · 45 comments

Comments

@maxm-ray
Copy link

maxm-ray commented Oct 9, 2018

I tried to upgrade from 10.13.6 to 10.14. Before restarting the script asks for the administrator credentials for the osinstallersetupd process.

Is there something wrong with the Script and 10.14?

img_0318

@RJTablante
Copy link

RJTablante commented Oct 9, 2018 via email

@memile123
Copy link

This is most likely related to issue #56
I was able to test added a few users to the admin group and this worked perfectly..

@hcgtexas
Copy link

Any update/workaround on this issue? My environment is almost completely non-admin users, so this is not working for me.

@memile123
Copy link

Agreed @hcgtexas I'd really like to start deploying this out our users.. script works great along with composer..

@CMDRPhaedra
Copy link

yeah I ran into this issue today... would love a workaround.. all our users are non-admin so this doesn't work for me either.. :(

@RJTablante
Copy link

RJTablante commented Oct 30, 2018 via email

@USicilianU
Copy link

Hi,

I am also in trouble where i have a park to update to macOS Mojave with standard user accounts and i also have the "osinstallersetupd" window asking for the admin password.
I will share with you the solution that I found and that works for me.

In the script "macOSUpgrade.sh" i check if the connected user is already admin with the dscl command. -read Groups / admin GroupMembership | cut -c 18- | grep "$ currentUser", if it does not have it I add it in "group admin" with the command dscl. -append groups / admin GroupMembership "$currentUser" and add the command dseditgroup -o edit -d "$ currentUser" -t user admin in the script of First boot "finishOSInstall.sh".

Thus the user becomes admin if he is not, and can run the installation process without problems.
After the update, during the first login the user becomes standard again.

I hope to have helped you with my solution.
By the way I wanted to congratulate @kc9wwh for this excellent script.

Excuse me for my English, it comes from Google translation.
Bye

@memile123
Copy link

@USicilianU Great! Do you mind sharing where you added that line? Was this a separate script?

@hcgtexas
Copy link

hcgtexas commented Nov 6, 2018

@USicilianU That sounds perfect! Do your changes have a check to make sure it won't remove admin if the user already had it before?

Can you share the whole edited script so I can see how you did it? I understand the logic, but I would like to see how you wrote it.

@USicilianU
Copy link

I put a condition that if the user is already admin I do not add to the next login the deletion of the user of the group admin. I will show you the script as soon as possible.

@kc9wwh
Copy link
Owner

kc9wwh commented Nov 6, 2018

What are peoples thoughts on this? I've thought of that, but am also worried that if something went wrong that the removal could not happen. I know I can't account for everything, but don't want to create a bigger issue either.

I also played around with integrating the SAP macOS Privileges app, but that isn't a perfect workflow either. ¯_(ツ)_/¯

@hcgtexas
Copy link

hcgtexas commented Nov 6, 2018

I like the add/remove admin rights workaround. There are obviously some things that can go wrong, but if the user doesn't even get prompted that they have admin rights, it is a lot less likely that they will abuse it.

Going through Jamf and checking admin rights to see if anyone has rights they shouldn't is a lot easier than going through the entire office and touching every single Mac.

@neilmartin83
Copy link

I second checking if the user is admin, then slipping them into the admin group and adding the necessary command to pull them out after the upgrade if they weren't in there to start with. If my understanding is correct, I would suggest evaluating whether the boot volume is APFS and if FileVault is enabled first and if both are yes then proceed to check the local user's admin group membership and do the deeds.

I think it's the only way we're going to get folks upgraded properly to 10.14.

@USicilianU
Copy link

USicilianU commented Nov 8, 2018

Hi,
That's a good point @neilmartin83
I added conditions, if FileVault and On and if currentUser is Admin then do not delete currentUser from Group Admin after reboot.
If FileVault and On and if currentUser is not Admin then add to the Admin Group and delete CurrentUser from Group Admin after reboot.
If FileVault is Off, you do not need to know if currentUser is Admin.

Here are the tests I did and that works for me:
Updated to Mojave.
macOS High Sierra, FileVault On, currentUser is not Admin: the script runs correctly
macOS High Sierra, FileVault On, currentUser is Admin: the script runs correctly
macOS El Capitan, FileVault Off, currentUser is not Admin: the script runs correctly

The only problem I still have is check the currentUser if Admin.
For example, I am connected with the user "smith" who is not admin and there are several local users with the names "smith, smith1, smith2, etc ...", and for example smith2 is admin, and the grep finds smith2 because he finds smith in the word and passes the user admin script.

I have to find a way to make a grep with strict case sensitive.
smith should not be the same as smith2 with grep.

I copy you the script below:
macOSUpgrade_2.7.2.1.txt

@Lotusshaney
Copy link

Use
id -Gn $currentUser

This will list all the groups a user is in and check that

@Lotusshaney
Copy link

Another way that is exact is to use the -x option in grep. This is a whole line so you have to format DSCL's output into lines

/usr/bin/dscl . read /Groups/admin GroupMembership | tr ' ' '\n' | grep -x $currentUser

this will use tr to convert spaces to carriage returns and then grep's -x option will work as an exact match

@USicilianU
Copy link

Thanks @Lotusshaney.

I also found this method that works:
dseditgroup -o checkmember -m "$currentUser" -t group admin | grep "yes"

@Lotusshaney
Copy link

yeah that works too, in-fact you should probably use dseditgroup to handle the group adding and removal as dscl is not really the correct Apple way anymore

@Lotusshaney
Copy link

Here is my go at the problem, I use a touch file in the users home folder and then get the LaunchDaemon to demote the user and clean up if its present.
macOSUpgrade_dan.txt

@USicilianU
Copy link

Hi,
I had to add at the end of the script the deletion of admin rights with a condition, if the installation fails following Requirements Not Met.

if [[ -z "$CheckUserAlreadyAdmin" ]]; then
/usr/sbin/dseditgroup -o edit -d "$currentUser" -t user admin
fi

@neilmartin83
Copy link

Awesome - I recommend using this method to get the current logged in user:

currentUser=$( scutil <<< "show State:/Users/ConsoleUser" | awk -F': ' '/[[:space:]]+Name[[:space:]]:/ { if ( $2 != "loginwindow" ) { print $2 }}' )

See http://erikberglund.github.io/2018/Get-the-currently-logged-in-user,-in-Bash/ for details - it's based on Ben Toms' blog post from a few years back which used Python to do it.

@riddl0rd
Copy link

riddl0rd commented Nov 9, 2018

Had tip from grahamrpugh It's the only line that does something affecting the user level, everything else is just running as root. when I comment it out the upgrade process runs perfect

/ /bin/launchctl bootstrap gui/"${userID}" /Library/LaunchAgents/com.apple.install.osinstallersetupd.plist

@Lotusshaney
Copy link

The problem with removing that line is it will not do an unattended reboot of a FileVault system. The user will have to enter there password at the FileVault login.

@donmontalvo
Copy link

donmontalvo commented Nov 14, 2018

Apple have recommended this command to accommodate computers that have Fast User Switching enabled:

current_user=$( python -c 'from SystemConfiguration import SCDynamicStoreCopyConsoleUser; import sys; username = (SCDynamicStoreCopyConsoleUser(None, None, None) or [None])[0]; username = [username,""][username in [u"loginwindow", None, u""]]; sys.stdout.write(username + "\n");' )

FWIW, we are using v2.6.1 of this script, updating/upgrading users to 10.13.6 and are seeing this prompt when current user is not admin:

osinstallersetupd

@donmontalvo
Copy link

I realize now 2.7.2.1 is the current version, we are on 2.6.1...before shifting gears and moving to this new version, is the above issue resolved in 2.7.2.1?

@USicilianU
Copy link

Hi @donmontalvo ,
Yes, this message also appears with script version 2.7.2.1

@ferriterj1
Copy link

ferriterj1 commented Nov 19, 2018

I am getting the "osinstallersetupd" popup in my environment where everyone is a standard user. None of my machines are filevaulted. Any reason why this would be happening?

@donmontalvo
Copy link

Opened a ticket with Jamf to see if they have any ideas. They echoed what was said on this issue thread, temporarily giving the current user admin rights, until the update/upgrade is done, then revoking admin rights when the update/upgrade is done. For understandable reasons this is outside the scope of what this script is designed to do, more of an issue that Apple may need to weigh in on, so we're opening a support ticket to see if this is a bug Apple needs to fix.

@memile123
Copy link

memile123 commented Nov 27, 2018

Meh.. it might be long before you get a resolution/response . We thought about going that route as well. So far here’s what has worked for us.

-Use this script along with a temp admin script that runs prior to the installer app gets placed
-We already had a demote non approved admins to standard script that runs on login in placed, so once the OS installation finished and the machine checked in, user would be demoted.

This has worked for High Sierra and Mojave 14.1

@fishd72
Copy link

fishd72 commented Nov 27, 2018

Opened a ticket with Jamf to see if they have any ideas. They echoed what was said on this issue thread, temporarily giving the current user admin rights, until the update/upgrade is done, then revoking admin rights when the update/upgrade is done. For understandable reasons this is outside the scope of what this script is designed to do, more of an issue that Apple may need to weigh in on, so we're opening a support ticket to see if this is a bug Apple needs to fix.

Personally, if your place of work operates under a "no one gets admin rights" kind of policy then this isn't going to fly as a solution. I'd say removing the authenticated restart and prompting the user for their password is a better workaround.

@neilmartin83
Copy link

Agree with @fishd72 - perhaps having auth restart configurable with a parameter, like the others in the script, to make it easier for folks to turn on/off. Then admins can decide to use that as a workaround and have control over it.

@fishd72
Copy link

fishd72 commented Dec 2, 2018

I recently removed the lines relating to running the launch agent and confirmed that if you're using the script to erase the device and install a fresh copy of the OS then it works as expected. If you're doing an in place upgrade, you're prompted half way through to enter your FileVault credentials but then the upgrade completes successfully.

@krispayne
Copy link

@Lotusshaney's updated script worked for my standard user with FV going from 10.13.6 to 10.14.1. It was hanging here:

2019-01-17 08:10:37-08 username osinstallersetupd[9411]: ensurePrebootVolumeForDisk: ensureRecoveryBooter instantly failed with error: -69863
2019-01-17 08:10:37-08 username osinstallersetupd[9411]: Operation queue failed with error: Error Domain=com.apple.OSInstallerSetup.error Code=224 "Could not create a preboot volume for APFS install." UserInfo={NSLocalizedDescription=Could not create a preboot volume for APFS install.}

This is where osinstallersetup would prompt for admin credentials for us.

After running @Lotusshaney's script, the user was not prompted, the install was successful, and they were removed from admin on first boot

@memile123
Copy link

@krispayne Nice! i cant seem to find his script or pull request with code changes.

@krispayne
Copy link

krispayne commented Jan 17, 2019

@memile123 ‘‘Tis but a link in a comment in this thread.

@Lotusshaney
Copy link

I did a pull request awhile ago but it got cancelled

@Lotusshaney
Copy link

It’s pull #86

@krispayne
Copy link

Either in this thread or the other I think that the idea of elevating then demoting wasn't wholly agreed upon since it's possible that the demotion wouldn't work all of the time, that and more strict environments where even the temporary elevation was considered policy violation.

That being said, it worked flawlessly this morning on a very troublesome machine.

@Lotusshaney
Copy link

He is a slightly updated version of the script the does the demote without requiring a user to be logged in. Give this a try if you like.

https://github.com/Lotusshaney/macOSUpgrade/blob/master/macOSUpgrade.sh

@kenchan0130
Copy link
Collaborator

It seems that this problem do not occur when I tried to upgrade to mojave with 10.14.3 installer.

@hcgtexas
Copy link

Very interesting. I will test that today. Can anyone else confirm this is not an issue with 14.3?

@kenchan0130
Copy link
Collaborator

@hcgtexas Thank you for your response.
I think that it can not be confirmed by my environment alone, so it would be nice to have some people try.

@hcgtexas
Copy link

Still asking me for admin credentials with the 10.14.3 installer

@kenchan0130
Copy link
Collaborator

That's unfortunate.
Perhaps my environment was special. I'm sorry.

@kenchan0130
Copy link
Collaborator

kenchan0130 commented Mar 29, 2019

It is good news for all of you.
It seems that this issue has been resolved by merging #97.

Thank you @taniguti!

And we want you to be careful a little bit, we are planning #100.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests