5

I've recently installed Debian 9 and encountered the following error.

During installation I've set up 'root' password and I've set up 'user' with his own password. Later when I log into 'user' account and want to install some package I have this problem. If I run:

sudo apt-get install 'package'

then I get this message:

'user' is not in sudoers list

And if I try to log into 'root' terminal with:

su

and enter password, I get:

su: Authentification error

P.S. I understand that question may be really silly, but I've not found any information about it in internet, so I need to ask it here.

9

It seems you have been bitten by a bug in the Debian 9 installer, as described in this forum topic: http://forums.debian.net/viewtopic.php?f=17&t=133604

There's a workaround given in the (currently) last post in that thread.

As I recall, the sudo command is not configured in Debian unless there is no root password given on install. Formerly, the sudo command was not even installed by default in Debian.

  • 1
    I think this post (linked from the thread you linked) is more relevant. You should edit in the salient points to your answer, because links can break. – Michael Homer Jul 15 '17 at 1:15
  • 1
    Also, bug report – Michael Homer Jul 15 '17 at 1:16
  • It's a known bug in the installer. bugs.debian.org/cgi-bin/bugrepo ... bug=866206 edit: IMO the easiest way to fix this is - 1. When grub starts, hit 'e' to edit the startup environment. 2. In the editor, find the line that starts with 'linux' and add CODE: SELECT ALL init=/bin/bash to the end of that line and hit esc or F10 to boot the machine. 3. Next, remount your root filesystem read-write like this - CODE: SELECT ALL mount -no remount,rw / 4. Change root's password like this - CODE: SELECT ALL passwd root 5. Reboot. Done :) – W.Jackson Aug 24 '17 at 0:25
  • You have to use the root user password when you execute su not your user's password. – mchid Aug 11 at 8:11
1

It sounds like you may not have added your non-root user to the list of sudoers. See man sudoers for details on this.

As for the second question, are you certain that you are using root's password? Unlike sudo, which asks for your password, su will ask for the password of the user to which you are switching.

  • It is a bug in the Debian 9 installer that is hitting people at the moment, as mentioned, but not explained properly, in another answer. – JdeBP Jul 15 '17 at 6:39
1

What I did is to edit /etc/group while booted a different way. Add your normal username to the sudo line (& group) at the end. Reboot. Then in a terminal as that user type sudo passwd root and enter a new password.

Booting from a live CD or in rescue mode from an install disk would probably work. I happen to have OpenBSD installed on the same drive so I used that.

The clue is in the /etc/sudoers file:

Allow members of group sudo to execute any command

%sudo ALL=(ALL:ALL) ALL

Just get yourself into the sudo group, you don't need to mess with the sudoers file at all. I just tried a cold boot and logged in as root to test it.

0

su: Authentification error

You are getting su: Authentication failure because you are trying to become root (which maybe disabled). Note su root will want the 'root' password and not the 'user' password.

Instead of su using sudo -i or better yet, append to any command sudo in the way of:

    sudo apt-get install something
    [sudo] password for user:

'user' is not in sudoers list

You can add the user to the sudo group:

sudo adduser <username> sudo  

The change will take effect after next login.

This works because /etc/sudoers is pre-configured to grant permissions to all members of this group . Though you should not make any changes to this:

# Allow members of group sudo to execute any command
%sudo   ALL=(ALL:ALL) ALL

As long as you have access to a user that is in the same groups as your "original" user, you can delete the old one.

-1

There should be a file called sudoers; locate that (in /etc probably (I can't tell you directly as I'm not on a Linux systems and mine is somewhere else, probably). man sudoers should tell you where it is.

You will need to enable your user to use sudo in there.

As noted in the sudoers file itself, and elsewhere, there are dire warnings about editing this file directly. Use the visudo command instead, as that will help to stop you shooting yourself in the foot. Despite its name, visudo will not necessarily use vi to edit the file; it will use your favourite editor, as set by the EDITOR environment variable.

  • 1
    I rather assumed he would read the manual page, and/or the actual file - which on my system at least have dire warnings that you must use visudo! I have no idea why my correct answer was downvoted. – Bob Eager Jul 14 '17 at 23:43
  • I would reiterate, if you are going to edit /etc/sudoers then visudo is designed to stop you shooting yourself in the foot - if it thinks there is an error in the file after your edit it but before it is finally saved then so will sudo and that will lock you out of using sudo to, er, do the things that it is essential to use it for... – SlySven Jul 15 '17 at 1:56
  • I don't disagree. And that is obvious to anyone looking at the sudoers file. – Bob Eager Jul 15 '17 at 5:23
  • "I have no idea why my correct answer was downvoted." Probably because you're telling somebody without root access to run a command only root can run. They can't sudo and they can't su; any solution that starts by assuming they have root isn't going to help them – Michael Mrozek Oct 20 '17 at 14:41
-2

To log in as root with su, use the root password you set at installation (not the user password).

To give sudo permissions to user, log in as root then add that user to the sudo group:

adduser user sudo

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.