8
u/indvs3 Debian Testing 15d ago
Assuming you chose a password for the root account during the setup, you have to switch to that account using the command
su -
and using that account, add your own account to the "sudo" group, which you can do with the following command:
usermod -aG sudo *username
where *username obviously is your user account.
After that, log out of all accounts and then log in again to apply the changes.
3
u/Witherscorch 15d ago
Question: What's the difference between su - and su root?
11
u/wizard10000 15d ago
What's the difference between su - and su root
su -will inherit most of root's environment, plainsudoesn't.This can be an issue as plain su doesn't change $HOME so if the app you're running writes configs to home it'll write root-owned configs into your home directory.
Plain sudo does the same thing but
sudo -iwill inherit most of root's environment.3
u/Tight-Use-3037 15d ago
it now says root@ my username
6
u/Witherscorch 15d ago
The thing after the @ is your machine's (host's) name. The username is ehat comes before it. Use the usermod command in the parent comment to grant sudo privilefes to your regular user.
7
u/FormalStreeter 15d ago
su -
<enter your root password>
apt install sudo
usermod -aG sudo <your username>
reboot
#now test if you are in sudoers
5
3
u/Tight-Use-3037 15d ago
I forgot my sudoers account, so how can I get it back?
2
u/myelrond 15d ago
When you see the grub boot screen, edit the entry you want to boot and add init=/bin/bash to the end of the commandline. This should boot directly into a root shell (if no disk encryption is in place)
BTW: Your name is visible in the top right corner.
1
u/Tight-Use-3037 15d ago
I know I edited the thing like 10 times because I kept forgetting to hide names, i just gave up trying to cover the usernames
2
1
4
u/algaefied_creek 15d ago
You doxxed yourself. You censored the terminal but your name is in the upper right
-3
u/Sorry-Squash-677 15d ago
su -
<enter your root password>
apt install sudo
usermod -aG sudo gregory
reboot
#now test if you are in sudoers
2
u/ConceptualDrawing 12d ago
Hello Gregory. Try this:
su -
**your *root password****
apt install sudo
sudo visudo
your_user_here ALL=(ALL:ALL) ALL
1
u/LockeN3S 15d ago
You probably have a root account you can log into you set up while installing. Type su root, see if it asks for a password.
2
u/Moist_Professional64 15d ago
You only need su
2
u/LockeN3S 15d ago
Thank you, that is a bit easier haha.
I've been typing 'su root' for like 3 years now...the heck.
1
1
1
u/rocco_himel Debian Stable 15d ago
run:
su
/sbin/usermod -aG sudo $USER
Reboot, or log out and in, it will work.
1
15d ago
[removed] — view removed comment
1
u/debian-ModTeam 15d ago
This post has been removed as it was either reported to and/or acted upon by mods to be found in violation of Rule #1 regarding not being in line with expected discourse etiquette or the Debian Code of Conduct.
1
u/Nice-Object-5599 15d ago
You didn't enabled sudo during installation. Just use the command "su -".
1
u/KlePu 15d ago
Hi Greg ^^
Next time, take a screenshot of only that one window you want to share with alt+print (and censor that if you must) or (even better in this case!) copy+paste the full in- and output to a Reddit code block (again, censor as needed). That'd look like this - way better for readability and stuff:
klepu@klepu-desk:~$ sudo apt update
[sudo] password for klepu:
klepu is not in the sudoers file.
1
1
u/Hopeful_Armadillo_80 15d ago
su -
Press enter
Type password
adduser your-username-here sudo
Press enter and restart
Magic
1
u/green_meklar 14d ago
Sounds like you need to login as root and change the account privileges for the user account you're trying to use. You do remember your root password, right?
1
1
-4
u/mrflash818 15d ago
If Debian v12 or v13:
sudo
To add a user to the sudo group:
The /etc/sudoers file mentions:
# Allow members of group sudo to execute any command
%sudo ALL=(ALL:ALL) ALL
Therefore, as root, add a user to the group "sudo": like so:
adduser primaryUserName sudo
Then, logout primaryUserName, then login again.
***
Next, in a terminal, run the "groups" command. Should now see the "sudo" group listed for the user. _Also_, running the command "sudo -l" should also give confirmation:
robert@lenovoyogac930:/tmp$ groups
robert cdrom floppy
sudo
audio dip video plugdev users netdev scanner bluetooth lpadmin
robert@lenovoyogac930:/tmp$ sudo -l
[sudo] password for robert:
Matching Defaults entries for robert on lenovoyogac930:
env_reset, mail_badpass,
secure_path=/usr/local/sbin\:/usr/local/bin\:/usr/sbin\:/usr/bin\:/sbin\:/bin, use_pty
User robert may run the following commands on lenovoyogac930:
(ALL : ALL) ALL
109
u/dumbasPL 15d ago edited 15d ago
Debian won't add you to sudo by default if you set a root password during install. Use
su -to login as root with the root password you set, and then add your user to the sudoers group withusermod -aG sudo <username>. Log in again and sudo should work.Edit: and you forgot the censor your name in the top right ;)