Mac Add a User From Terminal Mac
Step 1
Open a Terminal window. Click the "Go" pull-down at the top of the Finder, select "Utilities" and double-click the "Terminal" icon.
Step 2
Type "sudo dscl . -create /Users/username" and press "Enter." Replace "username" with a one-word name to identify the user. Replace all instances of "username" in future steps with the same one-word name. Enter your computer's administrator password and press "Enter" again. The prompt drops to the next line.
Related Reading: How to Configure iChat for Desktop Sharing in Mac OS X
Step 3
Type "sudo dscl . -create /Users/username UserShell /bin/bash" and press "Enter."
Step 4
Type "sudo dscl . -create /Users/username RealName "John Smith"" and press "Enter." Replace "John Smith" with the new user's full name.
Step 5
Type "sudo dscl . -create /Users/username UniqueID 1001" and press "Enter." The number after "UniqueID" must be an ID number that is not assigned to another user.
Step 6
Type "sudo dscl . -create /Users/username PrimaryGroupID 1000" and press "Enter."
Step 7
Type "sudo dscl . -create /Users/username NFSHomeDirectory /Local/Users/username" and press "Enter." This creates a home folder for the new user.
Step 8
Type "sudo dscl . -passwd /Users/username password" and press "Enter." Replace "password" with the desired password that the new user will use when logging in to the computer. You may need to type your computer's administrator password again to complete this action.
Step 9
Type "sudo dscl . -append /Groups/admin GroupMembership username" and press "Enter" to give the new user administrative privileges. To make the new account a limited user account, skip this step.
本文介绍通过 Mac 终端使用 dscl 命令创建新用户账户的详细步骤,包括设置用户名、用户壳、真实姓名、唯一 ID、主要组 ID 和 NFS 主目录等。

187

被折叠的 条评论
为什么被折叠?



