1

I recently did a clean install of Linux (the latest version of Debian, version 9.1, 64-bit Cinnamon) and am unable to add myself to the "sudo" group.

When logged in as myself, this is the output of the groups command:

daniel cdrom floppy audio dip video plugdev netdev bluetooth lpadmin scanner

When I use su to become root and enter the command adduser daniel sudo, the output is:

The user `daniel' is already a member of `sudo'.

Sure enough, if I use the command groups daniel while still logged in as root (with su), the output is:

daniel adm cdrom floppy sudo audio dip video plugdev netdev bluetooth lpadmin scanner

(Note that "sudo" is now in the list.)

I have logged out and logged back in several times, but I still am not in the "sudo" group when I run the groups command. This means that when I attempt to run a sudo command, I get the error:

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

Also, I have confirmed that the sudoers file contains an entry granting sudo privileges to the sudo group. When I run visudo, these lines are present:

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

I know that I can use visudo to manually add an entry that grants me sudo rights. I mainly want to know why I cannot add myself to the "sudo" group.

Sorry if this is a repeat question. I Googled for a while and couldn't find anyone else who could not add themselves to the sudo group.

  • Is there a difference in groups if you log in via TTY instead? – sebasth Sep 02 '17 at 04:35
  • This was my first time logging in with TTY. I pressed Ctrl-Alt-F1, entered my username and password, and typed groups, and the output did include "sudo." – Daniel Charles Sep 02 '17 at 04:56
  • 1
    Possibly related how display manager manages sessions, I've got a hunch your groups would be correct after a reboot (or alternatively killing all sessions using loginctl). – sebasth Sep 02 '17 at 04:58
  • You were right, @sebasth: after rebooting, "sudo" is now in the output of the groups command, and I can now use sudo. Thanks! If you want, if you add an answer below, I will mark it as answered. – Daniel Charles Sep 02 '17 at 05:07
  • 1
    I don't know the exact details why this happens to write insightful enough answer. I think its OK if you write down the observation with TTY and rebooting solving issue as your own answer and mark it accepted. – sebasth Sep 02 '17 at 05:09
  • 2
  • I do not believe this is a duplicate of that question. Prior to asking this question, I saw many posts which stated that logging out would fix the issue. As I stated in the original post, I logged out and back in several times, and that did not fix the issue. I needed to actually restart my computer for the change to take effect. – Daniel Charles Sep 02 '17 at 06:09
  • @muru This has nothing to do with the other question. The upvotes really raise questions... – Hauke Laging Sep 02 '17 at 08:41

0 Answers0