# Add user to SUDO group

**URL:** <https://forums.suse.com/t/add-user-to-sudo-group/28662>\
**Category:** SLES Configure-Administer\
**Created:** [September 18, 2016, 2:18pm UTC](https://forums.suse.com/t/add-user-to-sudo-group/28662 "2016-09-18T14:18:33Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![kamakay](https://avatars.discourse-cdn.com/v4/letter/k/9d8465/32.png) [@kamakay](https://forums.suse.com/u/kamakay)\
**Post date:** [September 18, 2016, 2:18pm UTC](https://forums.suse.com/t/add-user-to-sudo-group/28662/1 "2016-09-18T14:18:33Z")

</div>

Dear all

I am a newbye on Suse coming from ubuntu and I would like to add a brand new user to a specific group.

In ubuntu i run

sudo groupadd myuser  
sudo useradd -g mygroup mygroup

# add the user to sudoers

sudo adduser myuser sudo

but on SLES adduser is not found…

How can I accmplish this only with command ? (I am using this command sequence in a scirpt)

---

<div class="post-metadata">

**Author:** ![ab1](https://avatars.discourse-cdn.com/v4/letter/a/d2c977/32.png) [@ab1](https://forums.suse.com/u/ab1)\
**Post date:** [September 18, 2016, 6:25pm UTC](https://forums.suse.com/t/add-user-to-sudo-group/28662/2 "2016-09-18T18:25:12Z")

</div>

When you add a user to a group, you’re really modifying a group, so user  
the groupmod command:

```auto
groupmod -A username groupname
```

–  
Good luck.

If you find this post helpful and are logged into the web interface,  
show your appreciation and click on the star below…

---

<div class="post-metadata">

**Author:** ![kamakay](https://avatars.discourse-cdn.com/v4/letter/k/9d8465/32.png) [@kamakay](https://forums.suse.com/u/kamakay)\
**Post date:** [September 19, 2016, 10:06am UTC](https://forums.suse.com/t/add-user-to-sudo-group/28662/3 "2016-09-19T10:06:48Z")

</div>

Thanks!

As far as I have understood ubuntu has out of the box “sudo” group, SLES no.

So I need also to create sudo group

🙂

---

<div class="post-metadata">

**Author:** ![ab1](https://avatars.discourse-cdn.com/v4/letter/a/d2c977/32.png) [@ab1](https://forums.suse.com/u/ab1)\
**Post date:** [September 19, 2016, 3:48pm UTC](https://forums.suse.com/t/add-user-to-sudo-group/28662/4 "2016-09-19T15:48:38Z")

</div>

\On 09/19/2016 01:14 AM, kamakay wrote:[color=blue]

> Thanks!
> 
> As far as I have understood ubuntu has out of the box “sudo” group, SLES  
> no.
> 
> So I need also to create sudo group[/color]

SUSE Linux Enterprise Server (SLES) has always been targeted at the  
enterprise, and servers of course, where the first user setup (other than  
‘root’) may or may not be a user who should be privileged, so as a result  
it is not configured to make that user insanely-powerful. Ubuntu’s  
history has come from the desktop side of things, so the first user is  
usually sudo-enabled to do whatever they want provided they can prefix  
that something with ‘sudo’ (or equivalent).

If you want your user to be powerful there are a few ways to do it, but in  
the end the sudo packages are pretty similar and it’s just the  
/etc/sudoers file that is (I believe) different, so you could even use the  
same configuration file (with appropriate name/group changes as  
applicable) on either system.

SLES, by default, allows any user to use ‘sudo’ to do something provided  
they know the ‘root’ user’s password. This can be changed to be more like  
Unbuntu by commenting out the following two lines in the /etc/sudoers file:

```auto
Defaults targetpw # ask for the password of the target user i.e. root
ALL ALL=(ALL) ALL # WARNING! Only use this together with 'Defaults
targetpw'!
```

After commenting that out you need to grant rights to anybody who uses  
‘sudo’ explicitly, which can be done either by adding somebody to the OS’s  
‘wheel’ group (built-in group) and then uncommenting the following line in  
/etc/sudoers, or by doing manual things as you could do with any distribution:

```auto
# %wheel ALL=(ALL) ALL
```

The line above simply states that a member of the OS ‘wheel’ group can do  
anything on any box as anybody, but they still need to enter a password.

–  
Good luck.

If you find this post helpful and are logged into the web interface,  
show your appreciation and click on the star below…
