0

I have two accounts on my MacBook (runs Catalina 15.1), one is admin, one is non-admin.

Both are mine, so I know the password for both.

Sometimes when I want to run some 'sudo' command or use the GUI to install some software, I would like to not have to log out and log into the admin account. Is there any way I can just do this by entering the password to the admin acccount?

  • 1
    Strictly speaking this is no real duplicate but an invalid question. It contains two different questions - only one is reflected in the headline (after editing). 1. Priv elevation in the shell 2. Priv elevation in the GUI. – klanomath Jan 3 at 13:07
  • @ankii I've rolled back the edit, it changed too much. – nohillside Jan 3 at 13:17
  • 1
    I think this should be upvoted highly - and possibly closed. It really is two different questions. How do I choose a different user in GUI and How do I choose a different user in a shell - but the rule about one question per question is to get a good answer. Here, it’s feasible to answer both clearly and usefully and then link to the “canonical” here’s how to su (and not sudo) and the “canonical” - enter the admin user name to use the admin password. – bmike Jan 3 at 18:11
6

Yes, you can do it. You don't need to logout as both the GUI and the shell allow you to choose a different user to run in a non-admin account.

  • When it pops up for a password in GUI, enter the short echo $USER or long (what it shows in top right corner) admin account and then the admin password.

  • In terminal type, su username where username is your admin account name: echo $USER in admin account. After which, it will ask you to provide a password. This changes the shell to an admin shell and then you can sudo or just do. For spaces in username variable, for e.g. network accounts su "foo bar" to be used.

There are some more methods listed in these posts, like using sudoers, login etc.

| improve this answer | |

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .