3

I want to enable the mod_rewrite on Apache, I used Putty to access the server on my windows OS. I logged in using my username and password, My friend said that I should have root access to enable the mod_rewrite, so he advice me to type sudo su after I successfully log in. So I added sudo su command and it asked me a password again, so I type my password but I got an error.

[myusername] is not in the sudoers file.the incident will be reported

So maybe anyone here could help me.

Stephen C
  • 698,415
  • 94
  • 811
  • 1,216
  • Well, I suggest you ask your friend, maybe he simply forgot to add you to the `sudoers` file? – arkascha Dec 07 '16 at 01:59
  • Or you are logged in to a system running an operating system based on a distribution that follows the second logic of using `sudo`: that you have to type the password of the account you want to impersonate to be granted that right. To be able to do so you then would need to know the password of the `root` account. – arkascha Dec 07 '16 at 02:00
  • You see: _we_ cannot tell you, since we do not know the system. You and your friend know the system. – arkascha Dec 07 '16 at 02:01
  • thanks arkascha, is it possible for me(login using my username and password) and add [myuser] to the sudoers file? or there is anything else I can do to have a root privilige? – Rindang Cahyaning Dec 07 '16 at 02:07
  • Well obviously that is not possible, since that would mean that you could grant yourself privileges. That does not really make sense, does it? – arkascha Dec 07 '16 at 02:08
  • What you _can_ do is: ask the system administrator to add you. – arkascha Dec 07 '16 at 02:09
  • Possible duplicate of ['Username' is not in the sudoers file. This incident will be reported](https://stackoverflow.com/questions/47806576/username-is-not-in-the-sudoers-file-this-incident-will-be-reported) – Stephen C Jul 20 '19 at 12:51
  • Also a dup of https://stackoverflow.com/questions/11396678/editing-the-sudoers-file-on-mac-or-linux-when-you-have-no-permissions – Stephen C Jul 20 '19 at 13:00

5 Answers5

3

You can add a new user into sudo group in debian based systems (Ubuntu, kbuntu, debian, etc) and the wheel group under RedHat based systems (RedHat, Fedora, CentOS, etc) by using the following commands

usermod -a -G sudo user
or
usermod -a -G wheel user
officialrahulmandal
  • 2,473
  • 1
  • 23
  • 31
2
  1. restart your machine
  2. choose Advance ubuntu option
  3. then go for the root option
  4. you are now root here, root@machine:
  1. enter: usermod -aG sudo username

now you have added the user to sudo group, you can exit from root and login as a user. you can do this without restarting your machine if your root password is updated, by default it is not but if not, then you have to restart and set the root password by passwd command.

But if you already have a root password setup enter:

su -

and you will be root, but recommended is to use:

sudo -s

as a temporary root access

akash maurya
  • 607
  • 9
  • 16
0

It's necessary to add this user in a sudo group. You can do this, first, accessing the system using an admin user, next taking access to superuser mod:

sudo su

Then, you can add a user you need in a sudo group using the following commands:

adduser [username] sudo

iRib
  • 1
  • 2
0

su root nano /etc/sudoers Then add the user below admin user like below syntax. user_name ALL=(ALL) ALL

Amina K M
  • 15
  • 3
0

In the shell command line, type:

su -

After that, enter the same password for your ubuntu user.

In order to add your user to the sudo group, type:

adduser <youruser> sudo

Restart your Linux system to finished it.

mpb
  • 5
  • 3