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 ?
Disable Sudo – Remove Sudo Permission from User via Command Line
command lineprivilegessudousers
Best Answer
The user in question has sudo privileges because it is in the
admin
group. As wojox commented, you could usevisudo
and remove sudo privileges from the admin group, but that would remove sudo capabilities from all members of the admin group not just the one user.Alternatively, you can remove the user from the admin group. If screen oriented
vi
is considered command line enough, runvigr
and delete the username from the appropriate line.For a "pure" command line solution, try
gpasswd
, as it administers /etc/group and can add and delete users from groups.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
usermod
.Here's a quote from the
usermod
man page:So you have to specify all the groups for the user except for
admin
.Finally, it violates the spirit of the question, but one could type
users-admin
from the command line to modify users and groups.