solved Sudo..I'm confused

OP
brickwizard

brickwizard

Well-Known Member
Joined
Apr 28, 2021
Messages
1,232
Reaction score
950
Credits
9,314
Debian has two versions of su
There's su (no hyphen) which will take you into the user's account
and su - (with hyphen) which will take you into the System Root

I am too use to ubuntu me thinks o_O
I am out and about for a few hrs, will try later today
 


f33dm3bits

Gold Member
Gold Supporter
Joined
Dec 11, 2019
Messages
3,889
Reaction score
2,630
Credits
28,095
What does this file look like on your system?
Code:
cat /etc/sudoers
 
OP
brickwizard

brickwizard

Well-Known Member
Joined
Apr 28, 2021
Messages
1,232
Reaction score
950
Credits
9,314
[email protected]:~# cat /etc/sudoers
#
# This file MUST be edited with the 'visudo' command as root.
#
# Please consider adding local content in /etc/sudoers.d/ instead of
# directly modifying this file.
#
# See the man page for details on how to write a sudoers file.
#
Defaults env_reset
Defaults mail_badpass
Defaults secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"

# Host alias specification

# User alias specification

# Cmnd alias specification

# User privilege specification
root ALL=(ALL:ALL) ALL

# Allow members of group sudo to execute any command
%sudo ALL=(ALL:ALL) ALL

# See sudoers(5) for more information on "@include" directives:

@includedir /etc/sudoers.d
[email protected]:~# brian

----------
also tried to install flatpak that failed as well
 

kc1di

Well-Known Member
Joined
May 14, 2021
Messages
469
Reaction score
432
Credits
3,301
On my debian install I just use su. to become root. But have also setup sudo for my users which I perfer to use. But if I remember right sudo was not setup on initial install.
 

f33dm3bits

Gold Member
Gold Supporter
Joined
Dec 11, 2019
Messages
3,889
Reaction score
2,630
Credits
28,095
Can you change to the root user and run the following and share the output?
Code:
sudo -l -U brian
 
OP
brickwizard

brickwizard

Well-Known Member
Joined
Apr 28, 2021
Messages
1,232
Reaction score
950
Credits
9,314
[email protected]:~# sudo -l -u brian
usage: sudo -h | -K | -k | -V
usage: sudo -v [-AknS] [-g group] [-h host] [-p prompt] [-u user]
usage: sudo -l [-AknS] [-g group] [-h host] [-p prompt] [-U user] [-u user]
[command]
usage: sudo [-AbEHknPS] [-r role] [-t type] [-C num] [-D directory] [-g group]
[-h host] [-p prompt] [-R directory] [-T timeout] [-u user]
[VAR=value] [-i|-s] [<command>]
usage: sudo -e [-AknS] [-r role] [-t type] [-C num] [-D directory] [-g group]
[-h host] [-p prompt] [-R directory] [-T timeout] [-u user] file ..
 

f33dm3bits

Gold Member
Gold Supporter
Joined
Dec 11, 2019
Messages
3,889
Reaction score
2,630
Credits
28,095
OP
brickwizard

brickwizard

Well-Known Member
Joined
Apr 28, 2021
Messages
1,232
Reaction score
950
Credits
9,314
I am glad this all means something to you.. it may as well be in Spanish for me [i speak a little Greek]
[email protected]:~# sudo -l-U brian
sudo: invalid option -- '-'
usage: sudo -h | -K | -k | -V
usage: sudo -v [-AknS] [-g group] [-h host] [-p prompt] [-u user]
usage: sudo -l [-AknS] [-g group] [-h host] [-p prompt] [-U user] [-u user]
[command]
usage: sudo [-AbEHknPS] [-r role] [-t type] [-C num] [-D directory] [-g group]
[-h host] [-p prompt] [-R directory] [-T timeout] [-u user]
[VAR=value] [-i|-s] [<command>]
usage: sudo -e [-AknS] [-r role] [-t type] [-C num] [-D directory] [-g group]
[-h host] [-p prompt] [-R directory] [-T timeout] [-u user] file ...
 

f33dm3bits

Gold Member
Gold Supporter
Joined
Dec 11, 2019
Messages
3,889
Reaction score
2,630
Credits
28,095
Wrong again, there is a space between the dash -l and -U.
Code:
sudo -l (space) -U brian
 
Last edited:
OP
brickwizard

brickwizard

Well-Known Member
Joined
Apr 28, 2021
Messages
1,232
Reaction score
950
Credits
9,314
3a116884945f870924f1ffd3f36fc015--los-simpsons-homer-simpson.jpg
 
OP
brickwizard

brickwizard

Well-Known Member
Joined
Apr 28, 2021
Messages
1,232
Reaction score
950
Credits
9,314
[email protected]:~# sudo -l -U brian
Matching Defaults entries for brian on wizard-AOA110:
env_reset, mail_badpass,
secure_path=/usr/local/sbin\:/usr/local/bin\:/usr/sbin\:/usr/bin\:/sbin\:/bin

User brian may run the following commands on wizard-AOA110:
(ALL : ALL) ALL
 

f33dm3bits

Gold Member
Gold Supporter
Joined
Dec 11, 2019
Messages
3,889
Reaction score
2,630
Credits
28,095
It shows that your user actually has sudo acess. Can you run the following as your user brian.
Code:
sudo apt update
Then switch to the root user and run the following and share the output.
Code:
grep sudo /var/log/auth.log
 
OP
brickwizard

brickwizard

Well-Known Member
Joined
Apr 28, 2021
Messages
1,232
Reaction score
950
Credits
9,314
OP
brickwizard

brickwizard

Well-Known Member
Joined
Apr 28, 2021
Messages
1,232
Reaction score
950
Credits
9,314
[email protected]:~# sudo -l -U brian
Matching Defaults entries for brian on wizard-AOA110:
env_reset, mail_badpass,
secure_path=/usr/local/sbin\:/usr/local/bin\:/usr/sbin\:/usr/bin\:/sbin\:/bin

User brian may run the following commands on wizard-AOA110:
(ALL : ALL) ALL
[email protected]:~# grep sudo /var/log/auth.log
Oct 18 19:07:58 wizard-AOA110 sudo: brian : user NOT in sudoers ; TTY=pts/0 ; PWD=/home/brian ; USER=root ; COMMAND=/usr/bin/apt update
Oct 18 19:08:42 wizard-AOA110 sudo: brian : user NOT in sudoers ; TTY=pts/0 ; PWD=/home/brian ; USER=root ; COMMAND=/usr/bin/apt update
Oct 18 19:10:02 wizard-AOA110 sudo: pam_unix(sudo:auth): authentication failure; logname= uid=1000 euid=0 tty=/dev/pts/0 ruser=brian rhost= user=brian
Oct 18 19:10:21 wizard-AOA110 sudo: brian : user NOT in sudoers ; TTY=pts/0 ; PWD=/home/brian ; USER=root ; COMMAND=/usr/bin/apt update
Oct 18 19:24:53 wizard-AOA110 sudo: pam_unix(sudo:auth): authentication failure; logname= uid=1000 euid=0 tty=/dev/pts/0 ruser=brian rhost= user=brian
Oct 18 19:25:18 wizard-AOA110 sudo: brian : user NOT in sudoers ; TTY=pts/0 ; PWD=/home/brian ; USER=root ; COMMAND=/usr/bin/apt update
Oct 18 19:25:57 wizard-AOA110 sudo: pam_unix(sudo:auth): authentication failure; logname= uid=1000 euid=0 tty=/dev/pts/0 ruser=brian rhost= user=brian
Oct 18 19:26:13 wizard-AOA110 sudo: pam_unix(sudo:auth): conversation failed
Oct 18 19:26:13 wizard-AOA110 sudo: pam_unix(sudo:auth): auth could not identify password for [brian]
Oct 18 19:26:13 wizard-AOA110 sudo: brian : user NOT in sudoers ; TTY=pts/0 ; PWD=/home/brian ; USER=root ; COMMAND=/usr/bin/apt update
Oct 18 19:30:33 wizard-AOA110 sudo: pam_unix(sudo:auth): authentication failure; logname= uid=1000 euid=0 tty=/dev/pts/0 ruser=brian rhost= user=brian
Oct 18 19:30:41 wizard-AOA110 sudo: brian : user NOT in sudoers ; TTY=pts/0 ; PWD=/home/brian ; USER=root ; COMMAND=/usr/bin/apt update
Oct 18 21:38:34 wizard-AOA110 sudo: brian : user NOT in sudoers ; TTY=pts/0 ; PWD=/home/brian ; USER=root ; COMMAND=/usr/bin/apt update
Oct 18 21:39:03 wizard-AOA110 sudo: pam_unix(sudo:auth): authentication failure; logname= uid=1000 euid=0 tty=/dev/pts/0 ruser=brian rhost= user=brian
Oct 18 21:39:31 wizard-AOA110 sudo: pam_unix(sudo:auth): conversation failed
Oct 18 21:39:31 wizard-AOA110 sudo: pam_unix(sudo:auth): auth could not identify password for [brian]
Oct 18 21:39:31 wizard-AOA110 sudo: brian : user NOT in sudoers ; TTY=pts/0 ; PWD=/home/brian ; USER=root ; COMMAND=/usr/bin/apt update
Oct 19 08:33:34 wizard-AOA110 sudo: root : TTY=pts/0 ; PWD=/root ; USER=root ; COMMAND=/usr/bin/apt update
Oct 19 08:33:34 wizard-AOA110 sudo: pam_unix(sudo:session): session opened for user root(uid=0) by (uid=0)
Oct 19 08:33:44 wizard-AOA110 sudo: pam_unix(sudo:session): session closed for user root
Oct 19 08:34:20 wizard-AOA110 sudo: root : TTY=pts/0 ; PWD=/root ; USER=root ; COMMAND=/usr/bin/apt install -t unstable firefox
Oct 19 08:34:20 wizard-AOA110 sudo: pam_unix(sudo:session): session opened for user root(uid=0) by (uid=0)
Oct 19 08:34:21 wizard-AOA110 sudo: pam_unix(sudo:session): session closed for user root
Oct 19 10:53:59 wizard-AOA110 usermod[2619]: add 'brian' to group 'sudo'
Oct 19 10:53:59 wizard-AOA110 usermod[2619]: add 'brian' to shadow group 'sudo'
Oct 19 11:14:47 wizard-AOA110 sudo: brian : user NOT in sudoers ; TTY=pts/1 ; PWD=/home/brian ; USER=root ; COMMAND=/etc/apt/sources.list
Oct 19 13:09:21 wizard-AOA110 sudo: brian : TTY=pts/0 ; PWD=/home/brian ; USER=root ; COMMAND=/usr/bin/apt update
Oct 19 13:09:21 wizard-AOA110 sudo: pam_unix(sudo:session): session opened for user root(uid=0) by (uid=1000)
Oct 19 13:09:30 wizard-AOA110 sudo: pam_unix(sudo:session): session closed for user root
Oct 19 13:10:02 wizard-AOA110 sudo: brian : TTY=pts/0 ; PWD=/home/brian ; USER=root ; COMMAND=/usr/bin/apt install -t unstable firefox
Oct 19 13:10:02 wizard-AOA110 sudo: pam_unix(sudo:session): session opened for user root(uid=0) by (uid=1000)
Oct 19 13:10:02 wizard-AOA110 sudo: pam_unix(sudo:session): session closed for user root
Oct 19 13:10:56 wizard-AOA110 sudo: brian : TTY=pts/0 ; PWD=/home/brian ; USER=root ; COMMAND=/usr/bin/apt install flatpak
Oct 19 13:10:56 wizard-AOA110 sudo: pam_unix(sudo:session): session opened for user root(uid=0) by (uid=1000)
Oct 19 13:11:31 wizard-AOA110 sudo: pam_unix(sudo:session): session closed for user root
Oct 19 13:21:06 wizard-AOA110 sudo: brian : TTY=pts/0 ; PWD=/home/brian ; USER=root ; COMMAND=/usr/bin/flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
Oct 19 13:21:06 wizard-AOA110 sudo: pam_unix(sudo:session): session opened for user root(uid=0) by (uid=1000)
Oct 19 13:21:07 wizard-AOA110 sudo: pam_unix(sudo:session): session closed for user root
Oct 19 19:32:32 wizard-AOA110 sudo: brian : TTY=pts/0 ; PWD=/home/brian ; USER=root ; COMMAND=/usr/bin/apt update
Oct 19 19:32:32 wizard-AOA110 sudo: pam_unix(sudo:session): session opened for user root(uid=0) by (uid=1000)
Oct 19 19:32:42 wizard-AOA110 sudo: pam_unix(sudo:session): session closed for user root
[email protected]:~#
 

f33dm3bits

Gold Member
Gold Supporter
Joined
Dec 11, 2019
Messages
3,889
Reaction score
2,630
Credits
28,095
Oct 19 19:32:32 wizard-AOA110 sudo: brian : TTY=pts/0 ; PWD=/home/brian ; USER=root ; COMMAND=/usr/bin/apt update
Oct 19 19:32:32 wizard-AOA110 sudo: pam_unix(sudo:session): session opened for user root(uid=0) by (uid=1000)
Oct 19 19:32:42 wizard-AOA110 sudo: pam_unix(sudo:session): session closed for user root
According to those three auth.log lines you were granted sudo access for running "sudo apt update". Are still getting the message you aren't in the sudoers file?
 
Last edited:
OP
brickwizard

brickwizard

Well-Known Member
Joined
Apr 28, 2021
Messages
1,232
Reaction score
950
Credits
9,314
good morning... thank you all sudo for brian now works
ghyvnCGxdNXOXjBAJbcg.gif
ghyvnCGxdNXOXjBAJbcg.gif
 

Linuxembourg

Active Member
Joined
Apr 6, 2021
Messages
170
Reaction score
134
Credits
1,389
Debian has two versions of su
There's su (no hyphen) which will take you into the user's account
and su - (with hyphen) which will take you into the System Root
It is the other way around. Su without hyphen takes you into the system root.

I had the same issue as the OP. When installing you apparently should not enter any password for 'root' user and the first user you add will be added to the sudoers file. And the root user will be disabled.


It’s one of the things I hate about Debian. There’s a page on the installer where it asks you for a root password. If you read the fine print on that page, and follow the link to their documentation - you’ll see the “better” way would be to omit a password for root - in which case root gets disabled as a user which can login (much more secure).

If you omitted a root password then Debian sets your first user name as a sudo-er. Else it may not even have installed the sudo program, never mind if your user name is placed on the list. Which means all the rest can be avoided, by actually filling in less during the install.
 
$100 Digital Ocean Credit
Get a free VM to test out Linux!

Members online

No members online now.

Top