User is not in the sudoers file.The incident will be reported [duplicate]

I have just set up a Remote Desktop connection on Ubuntu LTS server and whenever I tries to install something a window prompts and asks for a password. I have tried the password but it’s not accepting it. I don't know what password it is asking for but It's not the one that I have set.

I tried looking on the Google and got some ways to resolve it but as soon as I follow it in the terminal I get another error stating User is not in the sudoers file. The incident will be reported. Then I looked on Internet to solve it but then they they say to write su -s in the terminal but then I get the error su:Authentication failure.

задан 12 August 2020 в 12:34

1 ответ

The reason for this is the user through which you enter commands is not the part of "super user" group. All the users in "super user" group can execute command as a root user. Therefore, even if you specify the correct password for that specific user unless it is part of "super user" group" it cannot execute sudo.

To solve the issue you need to add this user to the sudoers file.
To do this you can follow these commands :

sudo usermod -aG sudo user

Replace the user with the username you want to add to the sudoers. The -aG option tells the system to append the user to the specified group. (The -a option is only used with G.).

As you can see to add someone to the sudoers you first need a user who can exercise the "super user" rights. So either add this user to sudoers or you can use the user which is already added in "super user" group.

You can also read this


On some Linux distributions like Ubuntu, the root user account is disabled by default for security reasons. This means that no password is set for root and you cannot use su to switch to root. This explains the reason for su:Authentication failure

One option to change to root would be to prepend the su command with sudo and enter the currently logged in user password:

sudo su -

However it is not recommend to switch to root user to perform actions as it will have permission issues when you try to access or make changes later.

ответ дан 21 August 2020 в 08:03

Другие вопросы по тегам:

Похожие вопросы: