Announcement

Collapse
No announcement yet.

Lost SUDO from my Group when adding new Group

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Lost SUDO from my Group when adding new Group

    OK, so I have lost access to sudo​ on my new install. I was attempting to add group audio to myself using useradd -G {group-name} username as I found on Google but maybe I should have used the "-a" switch as well? Anyhow, the result of this change was that all my groups were removed and now I only have "audio". Great, so now no sudo access.

    More resarch led my the GUB recovery console. Now here I used groupscommand only to see that my user here in recovery had all the groups already, they just go missing when rebooting back into the desktop. I also in GRUB recovery added the command mount -n -o remount rw​ I figured this might help. Nope, it did not. So next I added a new user, again in GRUB recovery with the mount rw and this resulted in another fail, with no such user found when back in the desktop.

    So about now I am out of ideas and would appreciate any assistance please.

    #2
    Welcome.

    Warning: Never ever enter commands that you have found in the internet without understanding them!
    -> You can easily destroy your system and your data !!!


    For every command there is a man page, so if you want to know what it does and what the options are or mean, open the Konsole terminal emulator and enter
    man command, e.g. man useradd .
    Or use https://man7.org/linux/man-pages/index.html to view the man pages in a web browser.


    Here is how you revert the changes:
    • start your computer
    • in the GRUB boot menu choose "recovery mode" of the newest kernel
    • in the next menu choose "root" and "Ok"
    • press [Return]
    • -> You are now the root user, so be extra careful what you do and double-check for typing errors!!!
    • enter usermod -g primary_group your_user_name, e.g. usermod -g michael michael
      -> this makes the original group of your user its primary group again
    • enter usermod -aG adm,cdrom,sudo,dip,plugdev,lpadmin,lxd,sambashare your_user_name
      -> this re-adds your user to its default (Kubuntu) groups (usage: usermod -aG secondary_group user_name) , the -a option adds the user_name to a secondary_group without removing him from other groups
    • now you can check if everything is back to "normal" with id your_user_name
    • enter reboot to restart your system
    Next time use usermod -aG to add your user to an additional group, e.g. sudo usermod -aG audio michael .
    Log out and in again or restart the system to apply the group changes after adding your user to the audio group.

    Next time also let us know which Kubuntu release you are using (e.g. Kubuntu 22.04.4 LTS), please.
    Last edited by Schwarzer Kater; Apr 04, 2024, 03:44 AM. Reason: typos
    Debian KDE & LXQt • Kubuntu & Lubuntu • openSUSE KDE • Windows • macOS X
    Desktop: Lenovo ThinkCentre M75s • Laptop: Apple MacBook Pro 13" • and others

    get rid of Snap script (20.04 +)reinstall Snap for release-upgrade script (20.04 +)
    install traditional Firefox script (22.04 +)​ • install traditional Thunderbird script (24.04)

    Comment


      #3
      Originally posted by Schwarzer Kater View Post
      Next time use usermod -aG to add your user to an additional group, e.g. sudo usermod -aG audio michael .
      You can also use sudo adduser michael audio to add user michael to group audio, which is less prone to option errors like the one you experienced (don't need the "add " option)

      Comment

      Working...
      X