Posted on 04-19-2019 08:47 AM
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)?
Posted on 04-19-2019 09:02 AM
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
Posted on 04-19-2019 09:08 AM
@mack525 It is most definitely not executing as I just ran it manually from the tmp folder created and it did install.
Posted on 04-19-2019 09:16 AM
@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):
FULLNAME="Student Account" # The user's full name
USERNAME="student" # The user's shortname
PASSWORD="student" # The user's password
sysadminctl -addUser $USERNAME -fullName $FULLNAME -password $PASSWORD -picture "/Users/Shared/student_pic.jpg"
Posted on 04-19-2019 10:33 AM
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?
Posted on 04-19-2019 11:18 AM
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
Posted on 04-19-2019 11:35 AM
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...
Posted on 04-19-2019 12:43 PM
have you thought about using dscl?
Yes. I got the same behavior.
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
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.