Terminal. Where it all began for computing and where many admins feel right at home. Devoid of GUI or cumbersome mice–the modern command line is where much of the heavy lifting takes place.
With the ease of several keystrokes, sysadmins can control nodes and manage end users with their fingertips. Installing software, creating/modifying accounts, and configuring settings–or all three!
Let this article serve as an addendum to “5 commands Mac admins should know” by including another set of five commands to add to your arsenal of commonly used commands by IT.
1. Repair disk permissions on a volume
diskutil repairPermissions /
Runs a scan to repair permissions on a volume on the computer. Disk permissions are known to be the cause of some funky behavior at times on behalf of OS X. Regularly running these permissions checks to repair errors that build up over time is a great way to ensure the OS is operating well on disk.
2. Manually configure network settings
-setmanual “<networkservice>” ip subnet router
networksetup -setmanual “Wi-Fi” 192.168.1.101 255.255.255.0 192.168.1.1
Manually configures a network service, like Ethernet for example, with statically assigned addresses to allow for connectivity to the network/internet and security.
3. Create a new user account
dscl . create /Users/<username>
dscl . create /Users/<username> UserShell /bin/bash
dscl . create /Users/<username> RealName “<username>”
dscl . create /Users/<username> UniqueID <uniqueID>
dscl . create /Users/<username> PrimaryGroupID <groupID>
dscl . create /Users/<username> NFSHomeDirectory /Local/Users/<username>
The dscl command is the Directory Service Command Line utility, and it has a hand in creating new user accounts and modifying them as well. While it could be argued that it’s far simpler to create a new user utilizing the GUI, you never know what circumstances might lead you to needing to create an account via Terminal.
The commands, when run in succession, will create the new account. Next, modify the shell and real name for the user’s account, and then assign the uniqueID and groupID to determine membership. Finally, establish a path to the user account’s home directory.
4. Reset user account passwords
dscl . passwd /Users/<username> <password>
Resets an end user’s password–either locally or remotely. However, upon executing this command, the original password will be required in order to process the command and overwrite the previous password.
5. Add user account to group membership
-o -a -t
dseditgroup -o edit . -a <username> -t user admin
Edits the group membership to add a user account to the group specified. When adding users to the “admin” group, a reboot is required to replace the current settings with the new admin-level privileges.
The commands listed above are in no way exhaustive, but that isn’t the aim of this article. Rather, my hope is that by including these helpful commands, you’ll be inspired to seek out additional resources–such as Apple’s informative Manual Pages index–with which to adopt additional useful commands that best match your management style and organizational IT needs.
Subscribe to the Apple Weekly Newsletter
Whether you want iPhone and Mac tips or the latest enterprise-specific Apple news, we've got you covered. Delivered Tuesdays