[O/S] Terminal command for root
-
- Posts: 8
- Joined: 2021-08-04 09:02
[O/S] Terminal command for root
I am attempting to update Debian 12 Bookworm for the first time but every time i run the command sudo apt update im aske for my root password which i enter and im getting Michael@debian Michael is not in the sudoers file and i cant find a simple way to fix this..can someone with more experience than me,get me sorted out thanks for reading this post michael
-
- Global Moderator
- Posts: 3698
- Joined: 2014-07-20 18:12
- Location: Europe
- Has thanked: 100 times
- Been thanked: 486 times
Re: [O/S] Terminal command for root
Hello,
You can use the "su" command; for example, the following command will open a shell for the user root (the root password is required):
The shell prompt will change from $ to # (indicating that this is a root shell).
Hope this helps.
You can use the "su" command; for example, the following command will open a shell for the user root (the root password is required):
Code: Select all
su -l
Hope this helps.
Re: [O/S] Terminal command for root
Additionally, after having entered the root shell, you can add your user to the sudoers file with After this, you can 'sudo' in your normal user shell.
Code: Select all
usermod -aG sudo <your user name>
-
- Posts: 8
- Joined: 2021-08-04 09:02
- None1975
- df -h | participant
- Posts: 1491
- Joined: 2015-11-29 18:23
- Location: Russia, Kaliningrad
- Has thanked: 58 times
- Been thanked: 80 times
Re: [O/S] Terminal command for root
Hello.
Don't do this. Just login as root and add one simple command
Code: Select all
adduser yourusername sudo
P.S.
By the way, your can update your system in root shell with simple command
Code: Select all
su -
-
- Posts: 8
- Joined: 2021-08-04 09:02
Re: [O/S] Terminal command for root
Should not be -1 (minus one) but rather -l (minus small letter L)
-
- Posts: 8
- Joined: 2021-08-04 09:02
-
- Posts: 8
- Joined: 2021-08-04 09:02
Re: [O/S] Terminal command for root
hi juribel ive tried that command su -l which works so i enter root password ok and get a prompt..so enter usermod -ag sudo and my username but then taken to help screen list of su commands? so i am no futher foward and still cant add michael to sdoers list?
- bbbhltz
- Posts: 244
- Joined: 2024-01-10 14:53
- Location: Normandy
- XMMP/Jabber: bbbhltz@mailbox.org
- Has thanked: 61 times
- Been thanked: 57 times
Re: [O/S] Terminal command for root
Just doing this should work.
https://wiki.debian.org/sudo
You can see in the official wiki that this is the recommendation.None1975 wrote: ↑2024-08-10 10:22 Just login as root and add one simple command
where yourusername is your actual name. In Debian this is preferred method to add your user to sudo group.Code: Select all
adduser yourusername sudo
https://wiki.debian.org/sudo
Or course, sudo needs to be installed.Add existing user from commandline
To add an existing user with id=foo to group=sudo:
Code: Select all
$ sudo adduser foo sudo
bbbhltz
longtime desktop Linux user; eternal newbie
longtime desktop Linux user; eternal newbie
-
- Global Moderator
- Posts: 3698
- Joined: 2014-07-20 18:12
- Location: Europe
- Has thanked: 100 times
- Been thanked: 486 times
Re: [O/S] Terminal command for root
Hello,
Yes, because you mistyped "su -1" (minus one) when the command is "su -l" (minus l, l as the first character of the word "login").
-
- df -h | grep > 20TiB
- Posts: 1504
- Joined: 2012-10-06 05:31
- Location: /dev/chair
- Has thanked: 102 times
- Been thanked: 247 times
Re: [O/S] Terminal command for root
Enter (or copy-paste) CLI commands exactly as posted, including capitalisation.thomastt371 wrote: ↑2024-08-10 13:12enter usermod -ag sudo and my username but then taken to help screen list of su commands
Code: Select all
usermod -ag
Code: Select all
usermod -aG
There are at least 5 different ways to grant a user sudo permissions:
- Editing the /etc/sudoers file (read the comments in said file), either directly or with 'visudo'.
- Editing the /etc/group file to add your username to the 'sudo' group (which is already in /etc/sudoers).
- Using usermod to add your user to the 'sudo' group ('usermod -aG <group> <user>').
- Using adduser to do the same ('adduser <user> <group>').
- Using gpasswd to do the same ('gpasswd -a <user> <group>').
All of the above options have manual pages, e.g. 'man sudoers', 'man group', 'man usermod' etc.
Note any changes to group membership will require a logout/login to take effect.
Once is happenstance. Twice is coincidence. Three times is enemy action. Four times is Official GNOME Policy.