I have activated root user in ubuntu and want to use ubuntu as server with no DE. For this I want to disable sudo privilege given to first user. How can I do this from command line ? I know I can use a GUI but how to do it from command line ?
The user in question has sudo privileges because it is in the
Alternatively, you can remove the user from the admin group. If screen oriented
For a "pure" command line solution, try
Below is my first answer before I realized there was a less dumb way to do it.
If you'd like a more complicated way to do this, you can use
Here's a quote from the
So you have to specify all the groups for the user except for
Finally, it violates the spirit of the question, but one could type
Whatever wisdom may be found in the above answers, I've solved the issue of enabling the root account and disabling sudo for a specified user as follows.
First enable the root account:
More information in the Ubuntu Documentation.
The user 'guest' is now removed from the sudoers file. If all went well any sudo command should return a message the like of this:
A guest logging in on this computer can no longer accidentally or willingly mess with the system, since you need to be root to do so. Of course, if you add a new user, you will need to repeat the editing of /etc/group.
Carefull, you can lock yourself out of our system this way! Always make sure, that the root-user retains his rights and you can access it. Keep a root terminal open beforehand so you can undo changes. Test settings in another terminal before closing your root-terminal!
As described in another answer. Edit
Then change the line that says something similar to this:
Or delete the line, if you're sure, your root user account is enabled.
The default user is member of the 'admin' group. If you preferre it, you could just as well revoke the users membership to that group. Do that by following my last link or remove his name from the line