Skip to main content
Solved

Create new user using command line

  • July 11, 2024
  • 1 reply
  • 7 views

Forum|alt.badge.img+5
  • Contributor
  • 28 replies

Hi, 

 

How can I create new admin user using command line and user home will be delete automatically when remove from System Preferences?

I successfully create new admin user using the following command but when I delete this user from system preferences the home folder will not delete automatically compare to users create manually from system preferences.

Any advice?

Thank you

sudo sysadminctl -addUser Admin -fullName "Admin" -password admin123 -home /Users/admin -shell /bin/zsh -admin

Best answer by sdagley

@yjian Have you tried using the sysadminctl command without the -home option? Specifying the home directory is optional, and if you do specify a home path instead of allowing the sysadmin to create a home directory in the default location (which is what you appear to be trying to do) it may be treated differently when it comes to deletion.

1 reply

sdagley
Forum|alt.badge.img+25
  • Jamf Heroes
  • 3567 replies
  • Answer
  • July 11, 2024

@yjian Have you tried using the sysadminctl command without the -home option? Specifying the home directory is optional, and if you do specify a home path instead of allowing the sysadmin to create a home directory in the default location (which is what you appear to be trying to do) it may be treated differently when it comes to deletion.