I am trying to update software using

sudo apt-get

Then it says:

[sudo] password for thisismyusername:

Then I enter my username's password.

Then it says:

thisismyusername is not in the sudoers file. This incident will be reported.

I have tried this on 2 different computers and get the same thing. I typed out my password in LXTerminal as a command to check if there were any problems with my keyboard. What should I try here? I have not had this problem with my Raspberry PI which also has Linux.

  • You have to add your user to the sudo group. Dec 18, 2015 at 14:25
  • @RuiFRibeiro how is that done? Thanks!
    – user147855
    Dec 18, 2015 at 14:26

2 Answers 2


Debian, by default, creates a root user, and does not configure sudo. During the installation, you will have been asked to enter a root password. You need to use that to enable yourself to become root through sudo. First, run:

su -

This will ask for your root password. Enter that. Next, add yourself to the sudo group:

usermod -aG sudo your_username

Alternatively (Debian-specific), you can also use adduser to add yourself to a group:

adduser your_username sudo

Now log out of the root shell. You will be able to use sudo from now on.

If you don't know your root password, talk to the person who installed your machine and ask them to give you sudo rights. If that was you and you've forgotten it, you can create a new one:

  • Reboot your machine.
  • At the grub boot menu, highlight the "Debian GNU/Linux" option, then hit the e button on your keyboard. This will give you a sort of editor window where you can modify the boot commands.
  • In the editor, search for the line that starts with linux. At the end of that line, add init=/bin/bash. Do not change anything else. If you've made a mistake, hit the Esc button to go back to the menu and start over.
  • If you now hit ctrl + x, the system will boot to a bash prompt. The normal boot sequence will be completely bypassed, which means (amongst other things) that only the root filesystem will be mounted, and it will be mounted read-only.
  • Run mount -o remount,rw / to remount the filesystem in read-write mode.
  • Run passwd. The system will ask for a new password (twice, to confirm you didn't enter any typoes).
  • Run mount -o remount,ro / to put the filesystem back in the (safe) read-only mode
  • Run exec /sbin/init. The system will now boot as normal.

Note: doing this on a system that isn't yours will earn you the (rightly earned) wrath of the system's owner. Don't do it without their permission :-)


For a user to be able to sudo it has to belong to the sudo group per /etc/sudoersdefinitions.

$cat /etc/sudoers

To add your user to sudo group, in Debian, you have to run as root, the command:

usermod -aG sudo your_username

To have access as root without any sudo privilege, you have to login as root in the console, as there are security restrictions that prevent you from doing it remotely (via ssh for instance)

link to usermod man page:


  • When I run that with <> signs I get "bash: syntax error near unexpected token 'newline', when I run that without <> signs I get "bash: usermod: command not found." How do I fix? Thanks!
    – user147855
    Dec 18, 2015 at 14:32
  • Also: I tried "cd /etc/sudoers" to manually edit the config file myself and I get "bash: cd: /etc/sudoers: Not a directory".
    – user147855
    Dec 18, 2015 at 14:33
  • take them out, it is just a convention when giving examples. I have amended the post. Dec 18, 2015 at 14:33
  • /etc/sudoers is a file. vi /etc/sudoers. However, you can only do that as a root user, or once you have sudo working. Dec 18, 2015 at 14:34
  • thanks, but it still doesn't work without those signs (see second part of first comment on your answer here).
    – user147855
    Dec 18, 2015 at 14:34

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy