简体   繁体   中英

Make user account a sudo account

The internet isn't helping much with this query unfortunately, hoping someone here has some insight.

I wish to make my OSX (Yosemite) user account the sudo account, I can't seem to find a way to do it. I can turn on the sudo account, which just gives me an 'Other…' account on the login screen, which is of no use to anyone - I'd like to avoid having to sudo all the time in the shell, having to login to a dedicated account is even more of a hassle.

Is there really no way to simply assign sudo to an account, like you would make a Windows user an admin?

It seems this is something you can do in Debian, so it;s clearly not a crazy request…

sudo (Super User Do) is a command line program and not a property of an account.

As @alexwlchan suggested, there is a sudoers file which controls who can use the sudo command and what it does when they call it.

From your question, I gather that the problem is that you don't want to keep using the command repeatedly in the terminal.

One option is to use sudo to open a new bash shell. This would then be running as root, allowing all commands to be performed without the requirement of placing sudo in front of them. To do this, just type: -

sudo bash

Of-course, it is recommended that you use sudo instead, for the reasons of increased security. By ensuring you must call sudo, it also makes the user aware that the action is to be performed by someone with Administrative rights and makes the user think more about their actions.

Make the user (yourself?) an 'Admin' user in the 'Users & Groups' pane in 'System Preferences' (you do that by clicking the 'Allow user to administer this computer' box; and yes, only an admin user can change this).

There isn't such a thing as 'the sudo user', but instead being permitted to sudo is a property of a particular user, which OS X phrases as 'admin user'.

Detail: The underlying property is that the user is a member of the admin unix group, and if you're interested in seeing the gory details, it's the /etc/sudoers file (visible only to admin users) which says that everyone in the admin group is permitted to sudo anything.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM