R
R
Roman Radic2017-01-31 00:09:21
linux
Roman Radic, 2017-01-31 00:09:21

Is it possible to include a user in a sudo group without root privileges?

When setting up the server, Ubuntu 16.04 added itself to the sudo group. Everything worked fine, I disabled the root user for security reasons. Today I needed to add myself to the www-data group. Added with the command usermod -G www-data username . Now when I try to use sudo, it says is not in the sudoers file. This incident will be reported. . I understand that now I'm not in the sudo group. Is it possible to somehow fix this situation, or just reinstall the server?
PS
The server is not local, it's a remote VPS. The root password is not known to me either, authorization was only by SSH keys. I have my private keys, but the root user is disabled.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
K
K-700A, 2017-01-31
@K-700A

Needed was usermod -a -G www-data username . Without the "-a" option, you've left the user out of the rest of the groups.
The solution is here . Verified.

A
Alexey Cheremisin, 2017-01-31
@leahch

Usually I add a group with the command
Well, in order to restore justice, just boot from a flash drive and fix the group in /etc/groups and /etc/passwd
Well, you can boot without a flash drive, just adding init=/bin/ to the kernel boot parameters bash
And then remount the root system
mount / -o remount,rw

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question