Skip to main content

Hello,
I am working on a script to create a (standard) account. As tha machines have 10.14 I am using the sysadminctrl command (found the info in other threads here on JamfNation).



The account is created, but every time I do to login to the newly created account it asks to repair library.



After some digging I realized that the user directory (and all subdirectories) list root as the owner (rather than the new user I just created.



Anyone know what is causing this or how to obtain the correct behavior (creating a user who's home directory belongs to the created user)?

looks like you may need to add a chown or change group to the users group command to your script (-R for recursive) but id need to see the script (or what you can share) before further help =/



chgrp -R groupname path


@mack525 It is most definitely not executing as I just ran it manually from the tmp folder created and it did install.


@Hugonaut Thank you. Yes I have been having to do that, but I don't think I SHOULD have to do that. DO you have any idea why that is happening?



Here's the whole script I have been testing with (you might even recognize it from the thread I found it in):



!/bin/bash



create student account with password student



FULLNAME="Student Account" # The user's full name
USERNAME="student" # The user's shortname
PASSWORD="student" # The user's password



Create a local admin user account



sysadminctl -addUser $USERNAME -fullName $FULLNAME -password $PASSWORD -picture "/Users/Shared/student_pic.jpg"


edit



after looking at the man page it looks like an admin flag or (interactive] flag is required



    -addUser <user name> [-fullName <full name>] [-UID <user ID>] [-shell <path to shell>] [-password <user password>] [-hint <user hint>] [-home <full path to home>] [-admin] [-picture <full path to user image>] (interactive] || -adminUser <administrator user name> -adminPassword <administrator password>)


have you thought about using dscl?


this has worked for me from 10.14.0 forward:



sysadminctl -addUser admin -fullName "Administrator" -password Password -home /Users/admin -admin -shell /bin/bash -picture /Users/Shared/Adminicon.jpg


The account is created, but every time I do to login to the newly created account it asks to repair library.


@MDS_Ray I've used sysadminctl to create user account since 10.13, and have not encountered the repair library issue. Any time I've seen that problem appear in the MacAdmins Slack or this forum a common cause seems to be editing the User Template in the system library. Not sure if that's the situation here...


@Hugonaut



have you thought about using dscl?


Yes. I got the same behavior.



@Nix4Life



this has worked for me from 10.14.0 forward:

sysadminctl -addUser admin -fullName "Administrator" -password Password -home /Users/admin -admin -shell /bin/bash -picture /Users/Shared/Adminicon.jpg


Thanks I really thought adding that -home flag was going to work. Sadly, no joy



@sshort



a common cause seems to be editing the User Template in the system library


I have not done this, (to my knowledge). I have Jamf create an admin account at enrollment is it possible that Jamf does this? In any case thanks for the tip, it gives me something to look into.


Reply