Add user to SUDO group

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)

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

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…

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

:slight_smile:

\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:

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:

# %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…