0

I've done a mistake: I've removed the 'sudo' group, because I have forgotten the -a option (I wanted to add 'video' group):

sudo usermod -G video $USER

Now, when I want to call sudo I have this message:

orangepi@orangepi:~$ sudo apt-get update
[sudo] password for orangepi: 
Sorry, user orangepi is not allowed to execute '/usr/bin/apt-get update' as root on orangepi.

I read some solution (like visudo, or sudo adduser <username> sudo) but the problem persists. I can be root with calling su.

Some informations:

orangepi@orangepi:~$ groups
orangepi video               # I would like to add sudo, groupes and others

visudo:

Defaults        env_reset
Defaults        mail_badpass
Defaults        secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
root    ALL=(ALL:ALL) ALL

%admin ALL=(ALL) ALL

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

%shutdown ALL=(root) NOPASSWD: /usr/lib/arm-linux-gnueabihf/xfce4/xfsm-shutdown-helper

# Autoriser sudo ifup sans mot de passe
orangepi  ALL = (root) NOPASSWD: /sbin/ifup

How can I repair this?

1 Answer 1

2

Once you have become root via su, do:

adduser orangepi sudo

If you don't have adduser on your system, try with usermod -a to append to the groups list:

usermod -a -G sudo orangepi

You might also want to investigate which groups your user is a member of by default, and add those back as well (such as the group named after your user, adm, etc.).

Alternatively, you can use su -c:

su -c "adduser orangepi sudo"
5
  • Thanks, does it need a reboot? Because the groups command returns the same
    – Guillaume
    Commented Jan 27, 2015 at 13:57
  • @Guillaume No, the effect should be immediate. Did either command return an error?
    – muru
    Commented Jan 27, 2015 at 13:57
  • @muru I believe it needs at least a new login for the shell to pick up the new group membership - not a reboot, but either a logout-login or su -l $USER (or su - $USER etc.) Commented Jan 27, 2015 at 14:00
  • @steeldriver that's true if you were to try sg or some command which needed that group membership, but not for the groups command itself.
    – muru
    Commented Jan 27, 2015 at 14:01
  • After reboot, it works. I've added adm too, I havn't tried. Thanks a lot
    – Guillaume
    Commented Jan 27, 2015 at 14:03

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .