add user to sudoers

General support questions
Post Reply
matsmcfly
Posts: 7
Joined: 2019/03/21 16:02:06

add user to sudoers

Post by matsmcfly » 2019/03/21 16:08:31

Hi,

I have bee provided a VM running CentOS as a solution to run some data processing software that I cant run on my normal windows machine.

I am completely new to CentOS and very very basic with Linux in general.

The user I have been given does not seem to have SUDO rights - how do I add my user to the sudoers list without being SUDO?


thanks

User avatar
TrevorH
Site Admin
Posts: 33202
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: add user to sudoers

Post by TrevorH » 2019/03/21 16:13:55

In CentOS 7 users who are part of group wheel have full sudo access. You can add a user to that group by running, as root, usermod -a -G wheel $user
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke

matsmcfly
Posts: 7
Joined: 2019/03/21 16:02:06

Re: add user to sudoers

Post by matsmcfly » 2019/03/21 16:21:49

I obtain an error when I try this:

[dials@localhost ~]$ usermod -a -G wheel $dials

bash: /usr/sbin/usermod: Permission denied

pjsr2
Posts: 614
Joined: 2014/03/27 20:11:07

Re: add user to sudoers

Post by pjsr2 » 2019/03/21 17:29:53

Only root is allowed to modify user and group settings or change anything in the configuration for sudo.
Ask somebody who can use sudo to add you to the sudoers with the following command

Code: Select all

sudo  usermod -a -G wheel username
If you are new to Linux, you should definitely read up on the security and permissions model. It isn't difficult, but you must have a basic understanding before using the powers of root that sudo gives you. Never log in as root. If you need to execute a program with root privileges, use the sudo command to execute it. If you need to edit a file that requires root permissions to change it, use the sudoedit command.

User avatar
TrevorH
Site Admin
Posts: 33202
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: add user to sudoers

Post by TrevorH » 2019/03/21 18:05:29

Use su - to become root - it will ask for your root password which you set during the installation. Once root you can issue that command.
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke

Post Reply