sudoers – how to add users to a group in ubuntu

  1. If this is an existing users

Syntax: usermod -a -G groupname username

For example: usermod -a -G sudo myadminaccount -> this will make myadminaccount belong to sudo group , this mean it can run sudo su – to becom a root.

  1. For new user ( you haven’t created it yet)

Syntax: useradd -G groupname username

This will add a new username to a group name groupname

Leave a Reply

Your email address will not be published. Required fields are marked *