Quantcast

Add user to sudoers again

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
12 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Add user to sudoers again

Enrique Villalobos
Hello,

I run this command:

sudo usermod -G www-data myuser

I forgot the "-a":

sudo usermod -a -G www-data myuser

Now myuser is not a sudoer so I can't add it to sudoers and I have no
root password since I never needed it before.

Can it be fixed somehow?

Thank you!

--
ubuntu-users mailing list
[hidden email]
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Add user to sudoers again

Ralf Mardorf-2
Hi,

if you lose superuser permissions for what ever reason, maybe because
you just forgot the password, simply use a live media, than get
root access to the installed Linux via chroot or systemd-nspawn and
change the password, add a user to what groups ever etc.,
https://help.ubuntu.com/community/LiveCdRecovery#Lost_Password .

Regards,
Ralf


--
ubuntu-users mailing list
[hidden email]
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
Xen
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Add user to sudoers again

Xen
In reply to this post by Enrique Villalobos
Enrique Villalobos schreef op 12-04-2017 17:58:

> Hello,
>
> I run this command:
>
> sudo usermod -G www-data myuser
>
> I forgot the "-a":
>
> sudo usermod -a -G www-data myuser
>
> Now myuser is not a sudoer so I can't add it to sudoers and I have no
> root password since I never needed it before.
>
> Can it be fixed somehow?

Depending on what still works these days you can also:

in the Grub prompt, add "init=/bin/bash" to the kernel command line
parameters (the line that also says quiet or splash or whatever,
vmlinuz)

then the system boots but not much will work. You get a root prompt. You
have to change the filesystem to read-write first:

# mount -o rw,remount /

Then you can simply run passwd for your root user

# passwd

After that you can reboot and login to root with the new password and
fix it.

Regards.

--
ubuntu-users mailing list
[hidden email]
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Add user to sudoers again

Ralf Mardorf-2
On Wed, 12 Apr 2017 18:52:55 +0200, Xen wrote:

>Enrique Villalobos schreef op 12-04-2017 17:58:
>> I run this command:
>>
>> sudo usermod -G www-data myuser
>>
>> I forgot the "-a":
>>
>> sudo usermod -a -G www-data myuser
>>
>Then you can simply run passwd for your root user
>
># passwd
>
>After that you can reboot and login to root with the new password and
>fix it.

The password doesn't grant root privileges, if the user isn't in the
appropriate group ;).



--
ubuntu-users mailing list
[hidden email]
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Add user to sudoers again

Ralf Mardorf-2
On Wed, 12 Apr 2017 19:06:10 +0200, Ralf Mardorf wrote:

>On Wed, 12 Apr 2017 18:52:55 +0200, Xen wrote:
>>Enrique Villalobos schreef op 12-04-2017 17:58:  
>>> I run this command:
>>>
>>> sudo usermod -G www-data myuser
>>>
>>> I forgot the "-a":
>>>
>>> sudo usermod -a -G www-data myuser
>>>  
>>Then you can simply run passwd for your root user
>>
>># passwd
>>
>>After that you can reboot and login to root with the new password and
>>fix it.  
>
>The password doesn't grant root privileges, if the user isn't in the
>appropriate group ;).

Pardon, you recommend to add a root account!

+1


--
ubuntu-users mailing list
[hidden email]
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
Xen
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Add user to sudoers again

Xen
In reply to this post by Ralf Mardorf-2
Ralf Mardorf schreef op 12-04-2017 19:06:

> On Wed, 12 Apr 2017 18:52:55 +0200, Xen wrote:
>> Enrique Villalobos schreef op 12-04-2017 17:58:
>>> I run this command:
>>>
>>> sudo usermod -G www-data myuser
>>>
>>> I forgot the "-a":
>>>
>>> sudo usermod -a -G www-data myuser
>>>
>> Then you can simply run passwd for your root user
>>
>> # passwd
>>
>> After that you can reboot and login to root with the new password and
>> fix it.
>
> The password doesn't grant root privileges, if the user isn't in the
> appropriate group ;).

You just activated the root passwd. The root password is normally
disabled.

--
ubuntu-users mailing list
[hidden email]
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Add user to sudoers again

Oliver Grawert
In reply to this post by Enrique Villalobos
hi,
On Mi, 2017-04-12 at 17:58 +0200, Enrique Villalobos wrote:

>
> Now myuser is not a sudoer so I can't add it to sudoers and I have no
> root password since I never needed it before.
>
> Can it be fixed somehow?

press and hold shift during boot to get into the grub menu ... select
the recovery mode in the menu, that should give you a minimal root
shell where you can re-add the user to the sudoers group.

ciao
        oli
--
ubuntu-users mailing list
[hidden email]
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users

signature.asc (188 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Add user to sudoers again

Robert Heller
In reply to this post by Ralf Mardorf-2
You can also boot into single user mode and get the same level of
functionallity.  

At Wed, 12 Apr 2017 18:27:04 +0200 "Ubuntu user technical support,  not for general discussions" <[hidden email]> wrote:

>
> Hi,
>
> if you lose superuser permissions for what ever reason, maybe because
> you just forgot the password, simply use a live media, than get
> root access to the installed Linux via chroot or systemd-nspawn and
> change the password, add a user to what groups ever etc.,
> https://help.ubuntu.com/community/LiveCdRecovery#Lost_Password .
>
> Regards,
> Ralf
>
>

--
Robert Heller             -- 978-544-6933
Deepwoods Software        -- Custom Software Services
http://www.deepsoft.com/  -- Linux Administration Services
[hidden email]       -- Webhosting Services
                                                                                                                     

--
ubuntu-users mailing list
[hidden email]
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Add user to sudoers again

Enrique Villalobos
Hello,

Thank you all for your responses. This is how I resolved the problem
after reading all of them:

Press and hold shift button during boot to get into grub menu.

Boot in recovery mode.

This loads a menu. Select root terminal.

Remount root filesystem with read-write permissions: mount -o rw,remount /

Set root password: passwd

Add myuser to sudoers: usermod -a -G sudo myuser

Reboot.

Again, thank you very much.

Regards.

2017-04-12 20:03 GMT+02:00 Robert Heller <[hidden email]>:

> You can also boot into single user mode and get the same level of
> functionallity.
>
> At Wed, 12 Apr 2017 18:27:04 +0200 "Ubuntu user technical support,  not for general discussions" <[hidden email]> wrote:
>
>>
>> Hi,
>>
>> if you lose superuser permissions for what ever reason, maybe because
>> you just forgot the password, simply use a live media, than get
>> root access to the installed Linux via chroot or systemd-nspawn and
>> change the password, add a user to what groups ever etc.,
>> https://help.ubuntu.com/community/LiveCdRecovery#Lost_Password .
>>
>> Regards,
>> Ralf
>>
>>
>
> --
> Robert Heller             -- 978-544-6933
> Deepwoods Software        -- Custom Software Services
> http://www.deepsoft.com/  -- Linux Administration Services
> [hidden email]       -- Webhosting Services
>
>
> --
> ubuntu-users mailing list
> [hidden email]
> Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users

--
ubuntu-users mailing list
[hidden email]
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
Xen
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Add user to sudoers again

Xen
Enrique Villalobos schreef op 13-04-2017 10:43:

> Add myuser to sudoers: usermod -a -G sudo myuser

Be sure to fix the other groups as well:

cdrom floppy audio video lpadmin scanner bluetooth

are a few that could come to mind. Particularly audio and video can be
important.

Regards.

--
ubuntu-users mailing list
[hidden email]
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Add user to sudoers again

Enrique Villalobos
After 5 minutes of googling I found a way to know all the groups
myuser was added by default:

sudo grep "Adding user" /var/log/installer/syslog

Regards.

2017-04-13 10:58 GMT+02:00 Xen <[hidden email]>:

> Enrique Villalobos schreef op 13-04-2017 10:43:
>
>> Add myuser to sudoers: usermod -a -G sudo myuser
>
>
> Be sure to fix the other groups as well:
>
> cdrom floppy audio video lpadmin scanner bluetooth
>
> are a few that could come to mind. Particularly audio and video can be
> important.
>
> Regards.
>
>
> --
> ubuntu-users mailing list
> [hidden email]
> Modify settings or unsubscribe at:
> https://lists.ubuntu.com/mailman/listinfo/ubuntu-users

--
ubuntu-users mailing list
[hidden email]
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
Bob
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Add user to sudoers again

Bob
In reply to this post by Enrique Villalobos
** Reply to message from Enrique Villalobos <[hidden email]> on Thu,
13 Apr 2017 10:43:33 +0200

> Thank you all for your responses. This is how I resolved the problem
> after reading all of them:
>
> Press and hold shift button during boot to get into grub menu.
>
> Boot in recovery mode.
>
> This loads a menu. Select root terminal.
>
> Remount root filesystem with read-write permissions: mount -o rw,remount /
>
> Set root password: passwd
>
> Add myuser to sudoers: usermod -a -G sudo myuser
>
> Reboot.
>
> Again, thank you very much.
>
> Regards.

I have not read this list for a few days so I am a little late for the party.

When I first started using Ubuntu I made the same error because the Ubuntu book
I bought had a typo and they left out the -a parameter in their sample command.
I found the easiest way to recover was to copy the backup file over the
original file.


> 2017-04-12 20:03 GMT+02:00 Robert Heller <[hidden email]>:
> > You can also boot into single user mode and get the same level of
> > functionallity.
> >
> > At Wed, 12 Apr 2017 18:27:04 +0200 "Ubuntu user technical support,  not for general discussions" <[hidden email]> wrote:
> >
> >>
> >> Hi,
> >>
> >> if you lose superuser permissions for what ever reason, maybe because
> >> you just forgot the password, simply use a live media, than get
> >> root access to the installed Linux via chroot or systemd-nspawn and
> >> change the password, add a user to what groups ever etc.,
> >> https://help.ubuntu.com/community/LiveCdRecovery#Lost_Password .
> >>
> >> Regards,
> >> Ralf
> >>
> >>
> >
> > --
> > Robert Heller             -- 978-544-6933
> > Deepwoods Software        -- Custom Software Services
> > http://www.deepsoft.com/  -- Linux Administration Services
> > [hidden email]       -- Webhosting Services

--
Robert Blair


Democracy must be something more than two wolves and a sheep voting on what to have for dinner.  -- James Bovard, Civil Libertarian (1994)

--
ubuntu-users mailing list
[hidden email]
Modify settings or unsubscribe at: https://lists.ubuntu.com/mailman/listinfo/ubuntu-users
Loading...