Apple

5 more commands Mac admins should know

Jesus Vigo goes over five more commands that Mac admins should know to manage both users and systems remotely.

Commands Mac admins should know

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

Name
diskutil

Argument
repairPermissions

Example
diskutil repairPermissions /

Description
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

Name
networksetup

Argument
-setmanual "<networkservice>" ip subnet router

Example
networksetup -setmanual "Wi-Fi" 192.168.1.101 255.255.255.0 192.168.1.1

Description
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

Name
dscl

Argument
create

Example
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>

Description
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

Name
dscl

Argument
passwd

Example
dscl . passwd /Users/<username> <password>

Description
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

Name
dseditgroup

Argument
-o -a -t

Example
dseditgroup -o edit . -a <username> -t user admin

Description
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.

Also see

About Jesus Vigo

Jesus Vigo is a Network Administrator by day and owner of Mac|Jesus, LLC, specializing in Mac and Windows integration and providing solutions to small- and medium-size businesses. He brings 19 years of experience and multiple certifications from seve...

Editor's Picks

Free Newsletters, In your Inbox