Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

askthedev.com Logo askthedev.com Logo
Sign InSign Up

askthedev.com

Search
Ask A Question

Mobile menu

Close
Ask A Question
  • Ubuntu
  • Python
  • JavaScript
  • Linux
  • Git
  • Windows
  • HTML
  • SQL
  • AWS
  • Docker
  • Kubernetes
Home/ Questions/Q 14176
Next
In Process

askthedev.com Latest Questions

Asked: September 27, 20242024-09-27T01:25:30+05:30 2024-09-27T01:25:30+05:30In: Ubuntu

Is there a way to prevent the admin group from being automatically generated when using sudo on Ubuntu?

anonymous user

I’ve been diving into the Linux world lately, especially Ubuntu, and I stumbled upon something that’s been bugging me. So, when you use `sudo`, it seems that Ubuntu automatically adds you to the admin group, which means more privileges and potential for really messing things up if you’re not super careful. I get that it’s designed to make things easier for new users, but what about those of us who prefer to keep things a bit more locked down?

I was wondering if there’s a way to stop this automatic admin group generation when using `sudo`. I mean, I love the command-line interface and all, but it feels like having too much power can be dangerous! You know, like giving a kid a box of matches without supervision. I don’t want accidents waiting to happen.

I read about the `/etc/sudoers` file where permissions are set up, and even learned that there are specifics on how groups are assigned privileges, but it feels a little overwhelming to just jump in there without fully knowing what I’m doing. I’ve heard that editing the `sudoers` file incorrectly can lock you out of using `sudo` entirely, which sounds like a nightmare. I want to experiment with my setup and maybe even learn something new, but I also don’t want to blow my system up in the process.

Has anyone figured out a way to disable this automatic addition to the admin group, or at least have better control over who gets those permissions? Maybe there’s a command or a specific setting that I’m overlooking? I’m all for using `sudo` responsibly, but I’d really like to have the final say in how much privilege I have when I use it.

I’m sure there are folks out there with more experience who have tackled this before, so I’d love to hear your thoughts or advice on how to approach this! Any guidance would be amazing, whether it’s a simple command or a series of steps. I’m all ears!

  • 0
  • 0
  • 2 2 Answers
  • 0 Followers
  • 0
Share
  • Facebook

    Leave an answer
    Cancel reply

    You must login to add an answer.

    Continue with Google
    or use

    Forgot Password?

    Need An Account, Sign Up Here
    Continue with Google

    2 Answers

    • Voted
    • Oldest
    • Recent
    1. anonymous user
      2024-09-27T01:25:32+05:30Added an answer on September 27, 2024 at 1:25 am

      When using `sudo` in Ubuntu, it’s true that users are typically added to the “sudo” group, granting them administrative privileges. If you’re looking to tighten the reins on permissions and prevent automatic elevation to the admin group, one effective approach is to create and configure a separate group for users with `sudo` privileges. You can still use `sudo`, but you would assign that capability only to specific users or groups. First, you would create a new group, say “limited_sudo,” using the command sudo groupadd limited_sudo. Then, add the users you wish to grant limited `sudo` access to this group. Finally, modify the /etc/sudoers file using visudo to allow only members of the “limited_sudo” group to execute sudo commands, which will help in preventing unwanted privilege escalation.

      Editing the /etc/sudoers file can indeed be daunting, but it’s crucial to follow the correct format. Once you open it with visudo, you’ll want to add a line like %limited_sudo ALL=(ALL:ALL) ALL. This allows members of the “limited_sudo” group to run any command with `sudo`, while users outside this group won’t have any access. This way, you maintain control over who can use `sudo` without risking misconfigurations that could inadvertently lock you out of sudo functionality. Always remember to take extreme caution while editing /etc/sudoers to prevent any system access issues; the visudo command does some syntax checking to help keep you safe.

        • 0
      • Reply
      • Share
        Share
        • Share on Facebook
        • Share on Twitter
        • Share on LinkedIn
        • Share on WhatsApp
    2. anonymous user
      2024-09-27T01:25:31+05:30Added an answer on September 27, 2024 at 1:25 am






      Managing sudo Privileges in Ubuntu


      Managing sudo Privileges in Ubuntu

      Totally get where you’re coming from! Diving into the Linux world can be a bit intimidating, especially when it comes to privileges and permissions. Using `sudo` gives you a lot of power, which can lead to some pretty big mistakes if you’re not careful.

      First off, you’re right about the /etc/sudoers file! It’s where all the magic happens regarding who can do what with `sudo`. But, you’re also right to be cautious. Messing that file up can definitely lock you out from using `sudo` altogether, and that’s definitely not fun!

      Disabling Automatic Admin Group Addition

      To have better control over `sudo` privileges, you can create a custom user group instead of the default admin or sudo group. Here’s how you can go about it:

      1. Create a new group:

        sudo groupadd mygroup

      2. Add yourself (or others) to that group:

        sudo usermod -aG mygroup $USER

      3. Edit the /etc/sudoers file carefully:

        Use visudo command to edit it safely:

        sudo visudo

        Then add a line like:

        mygroup ALL=(ALL:ALL) ALL

        This will give the members of mygroup the right to use sudo. Don’t forget to replace mygroup with the group you created.

      After these steps, you can be more selective about who gets sudo access while reducing the risk. It’s like keeping the matches away from the kids, right?

      And just a tip: Always make a backup of your /etc/sudoers file before editing it. If something goes wrong, you’ll have a way to revert back. Use:

      sudo cp /etc/sudoers /etc/sudoers.bak

      Good luck, and remember, it’s all about taking it step-by-step! Experiment safely!


        • 0
      • Reply
      • Share
        Share
        • Share on Facebook
        • Share on Twitter
        • Share on LinkedIn
        • Share on WhatsApp

    Related Questions

    • I'm having trouble installing the NVIDIA Quadro M2000M driver on Ubuntu 24.04.1 LTS with the current kernel. Can anyone provide guidance or solutions to this issue?
    • What steps can I take to troubleshoot high usage of GNOME Shell in Ubuntu 24.04?
    • I recently performed a fresh installation of Ubuntu 24.04, and I've noticed that my RAM usage steadily increases over time until my system becomes unresponsive. Has anyone experienced this issue ...
    • How can I resolve the "unknown filesystem" error that leads me to the GRUB rescue prompt on my Ubuntu system?
    • I'm experiencing an issue with Ubuntu 24.04 where Nautilus fails to display the progress indicator when I'm copying large files or folders. Has anyone else encountered this problem, and what ...

    Sidebar

    Related Questions

    • I'm having trouble installing the NVIDIA Quadro M2000M driver on Ubuntu 24.04.1 LTS with the current kernel. Can anyone provide guidance or solutions to this ...

    • What steps can I take to troubleshoot high usage of GNOME Shell in Ubuntu 24.04?

    • I recently performed a fresh installation of Ubuntu 24.04, and I've noticed that my RAM usage steadily increases over time until my system becomes unresponsive. ...

    • How can I resolve the "unknown filesystem" error that leads me to the GRUB rescue prompt on my Ubuntu system?

    • I'm experiencing an issue with Ubuntu 24.04 where Nautilus fails to display the progress indicator when I'm copying large files or folders. Has anyone else ...

    • How can I configure a server running Ubuntu to bind specific IP addresses to two different network interfaces? I'm looking for guidance on how to ...

    • Is it possible to configure automatic login on Ubuntu MATE 24.04?

    • After upgrading from Ubuntu Studio 22.04 to 24.04.1, I lost all audio functionality. What steps can I take to diagnose and resolve this issue?

    • I am experiencing issues booting Ubuntu 22.04 LTS from a live USB. Despite following the usual procedures, the system fails to start. What steps can ...

    • I'm encountering a problem with my Expandrive key while trying to update my Ubuntu system. Has anyone else faced similar issues, and if so, what ...

    Recent Answers

    1. anonymous user on How do games using Havok manage rollback netcode without corrupting internal state during save/load operations?
    2. anonymous user on How do games using Havok manage rollback netcode without corrupting internal state during save/load operations?
    3. anonymous user on How can I efficiently determine line of sight between points in various 3D grid geometries without surface intersection?
    4. anonymous user on How can I efficiently determine line of sight between points in various 3D grid geometries without surface intersection?
    5. anonymous user on How can I update the server about my hotbar changes in a FabricMC mod?
    • Home
    • Learn Something
    • Ask a Question
    • Answer Unanswered Questions
    • Privacy Policy
    • Terms & Conditions

    © askthedev ❤️ All Rights Reserved

    Explore

    • Ubuntu
    • Python
    • JavaScript
    • Linux
    • Git
    • Windows
    • HTML
    • SQL
    • AWS
    • Docker
    • Kubernetes

    Insert/edit link

    Enter the destination URL

    Or link to existing content

      No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.