The officially official Devuan Forum!

You are not logged in.

#1 2023-08-23 14:29:01

evilpistachio
Member
Registered: 2023-08-23
Posts: 4  

[SOLVED] (username) is not in the sudoers file.

Hello this is my first time using a linux distro and I tried installing tor browerser but it says that my only username on this installation is not in the sudoers file which probably means I can't execute sudo commands.

My question is how do I enable myself to use them? Thank you in advance.

Offline

#2 2023-08-23 15:54:37

Gregors
Member
From: Freiburg, Germany
Registered: 2018-08-09
Posts: 41  
Website

Re: [SOLVED] (username) is not in the sudoers file.

I don't use sudo. If I have to do something only root can do I use "su -",

HTH

Gregor

Offline

#3 2023-08-23 16:01:09

stopAI
Member
Registered: 2023-04-04
Posts: 185  

Re: [SOLVED] (username) is not in the sudoers file.

Hello.

Once logged in as a user, you can verify whether or not the user belongs to group=sudo using either the id or groups commands. E.g., a user with id=foo should see output from

$ groups

like

foo sudo

If sudo is not present in the output, the user does not belong to that group.

To add an existing user with id=foo to group=sudo:

get root and then run the command:

# adduser foo sudo

After being added to a new group the user must log out and then log back in again for the new group to take effect.

Last edited by stopAI (2023-08-23 16:01:52)

Offline

#4 2023-08-23 18:54:19

evilpistachio
Member
Registered: 2023-08-23
Posts: 4  

Re: [SOLVED] (username) is not in the sudoers file.

Thanks for the advice! I managed to find how to get access to root online but when I tried

# adduser foo sudo

it said that adduser command doesn't exist.

Thanks for the advice never the less!

Offline

#5 2023-08-23 19:33:40

steve_v
Member
Registered: 2018-01-11
Posts: 381  

Re: [SOLVED] (username) is not in the sudoers file.

evilpistachio wrote:

adduser command doesn't exist.

Devuan inherits the shadow -> util-linux change to su behavior from upstream Debian as mentioned here, and the same solutions apply.


Once is happenstance. Twice is coincidence. Three times is enemy action. Four times is Official GNOME Policy.

Offline

#6 2023-08-24 08:51:00

evilpistachio
Member
Registered: 2023-08-23
Posts: 4  

Re: [SOLVED] (username) is not in the sudoers file.

Thanks a ton, I managed to add myself into sudo. Marking as solved.

Offline

#7 2024-10-13 09:56:54

odie2
Member
From: The Netherlands
Registered: 2024-02-28
Posts: 4  
Website

Re: [SOLVED] (username) is not in the sudoers file.

Debian also returns "YourUserName is not in the sudoers file", when issuing the sudo command.
To add YourUserName to /[etc/sudoers] perform the following actions:

> open Terminal
   

su - root

    > type the password of the root account
   

visudo

    > press the [arrow-down] button
    > go to section "# User privilege specification"
    > add a line beneath "root...ALL": "{YourUserName} ALL=(ALL:ALL) ALL", e.g.:
   

obi7kenobi ALL=(ALL:ALL) ALL

    > press [ctrl]+[O] (write out)

    message: "file name to write: /etc/sudoers.tmp"
    This file name is OK. The actual file is [/etc/sudoers].

    > press <enter>
    > press [ctrl+[X] to exit the editing mode

Offline

#8 2024-10-14 23:55:28

VPigEePMUn7X
Member
Registered: 2024-10-08
Posts: 5  

Re: [SOLVED] (username) is not in the sudoers file.

> press the [arrow-down] button
    > go to section "# User privilege specification"
    > add a line beneath "root...ALL": "{YourUserName} ALL=(ALL:ALL) ALL", e.g.:

@odie2 that is incorrect advice. sudoers file already has an entry for sudo privileges for all members of sudo group. If you want to use sudo, add your user to sudo group, as mentioned few weeks ago by @stopAI. No need to modify sudoers file.

Offline

#9 2024-10-15 10:39:54

Altoid
Member
Registered: 2017-05-07
Posts: 1,581  

Re: [SOLVED] (username) is not in the sudoers file.

Hello:

Gregors wrote:

... do something only root can do I use "su -" ...

That is quite correct.

But sudo does have a great many proper use scenarios.
eg: every time I want to have a look at what dmesg is printing out or run updatedb.

Here are a couple of snippets from an article by one of the admins in the PCLinuxOS Magazine back in 2012:

Old-Polack wrote:

Sudo is just another Linux tool, but one that when abused, can drastically impair the security of one’s system.

... proper use of sudo as a limiting resource, when root privileges are needed for a specific repeatable purpose, such as when needed for the proper functioning of an application, within a script, or when a specific user on a multi user system is assigned limited administrative duties, but is not allowed access to the root password or full root privileges. This is the purpose for which sudo was intended.

... care should be taken to limit a user’s entry in /etc/sudoers to the absolute minimum of specific commands needed to perform the task at hand.

* undelining is mine.

I'd say that allowing members of group sudo to execute any command is a huge risk.
Not a convenience.

Of course and as always, YMMV.

Best,

A.

Offline

Board footer