Use Mac’s Terminal as Another User

This is a quick tip that I thought I’d share for those managing machines for an organization (or maybe just your own family). Every once in a while you may need to run Terminal commands that require admin privileges, but either the user account your under isn’t an admin or you can’t switch user accounts to run that command where you know the password. In these cases there is a wonderful little function that will let you use the Terminal as a different user than the one you’re currently logged into (provided you know the login credentials for that account).

In your terminal, type the following command and hit Enter


When you hit Enter, a new line will appear that just says login: . Here is where you’ll type the username of your account. If for some reason you’re not sure what it is, open Finder and go to your user directory, and look at the folder names for each user. Those are the proper user names and the one you’ll need to use.

Once you’ve type that in, hit Enter again, and you’ll be prompted with the password for that user account. Type it in, and hit Enter once more.

After a second or two, assuming you typed in the info correctly, a new line will appear that will have the username you type in follow by the @ sign and the name of your computer. For example, if an iMac belongs to someone named Jim and the admin account is named “admin”, then the line will look like:

admin@Jim-iMac ~ %

Note that the Terminal will now have the same permissions as the account used in the login command, so if that account isn’t an admin, it won’t let you do admin things.

Feel free to comment.

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.