You are not logged in.

#1 2011-09-24 21:54:02

nhianho
Member
Registered: 2011-08-05
Posts: 30

[Solved] sudo doesn't ask for password

I just reinstalled archbang, and after I used visudo to give sudo privilege to my casual user name, when I run any command at root, it doesnt ask me for password anymore. How to fix ?

Here is the sudoers.tmp

## sudoers file.
##
## This file MUST be edited with the 'visudo' command as root.
## Failure to use 'visudo' may result in syntax or file permission errors
## that prevent sudo from running.
##
## See the sudoers man page for the details on how to write a sudoers file.
##

##
## Host alias specification
##
## Groups of machines. These may include host names (optionally with wildcards),
## IP addresses, network numbers or netgroups.
# Host_Alias    WEBSERVERS = www1, www2, www3

##
## User alias specification
##
## Groups of users.  These may consist of user names, uids, Unix groups,
## or netgroups.
# User_Alias    ADMINS = millert, dowdy, mikef

##
## Cmnd alias specification
##
## Groups of commands.  Often used to group related commands together.
# Cmnd_Alias    PROCESSES = /usr/bin/nice, /bin/kill, /usr/bin/renice, \
#                 /usr/bin/pkill, /usr/bin/top

##
## Defaults specification
##
## You may wish to keep some of the following environment variables
## when running commands via sudo.
##
## Locale settings
# Defaults env_keep += "LANG LANGUAGE LINGUAS LC_* _XKB_CHARSET"
##
## Run X applications through sudo; HOME is used to find the
## .Xauthority file.  Note that other programs use HOME to find   
## configuration files and this may lead to privilege escalation!
# Defaults env_keep += "HOME"
##
## X11 resource path settings
# Defaults env_keep += "XAPPLRESDIR XFILESEARCHPATH XUSERFILESEARCHPATH"
##
## Desktop path settings
# Defaults env_keep += "QTDIR KDEDIR"
##
## Allow sudo-run commands to inherit the callers' ConsoleKit session
# Defaults env_keep += "XDG_SESSION_COOKIE"
##
## Uncomment to enable special input methods.  Care should be taken as
## this may allow users to subvert the command being run via sudo.
# Defaults env_keep += "XMODIFIERS GTK_IM_MODULE QT_IM_MODULE QT_IM_SWITCHER"
##
## Uncomment to enable logging of a command's output, except for
## sudoreplay and reboot.  Use sudoreplay to play back logged sessions.
# Defaults log_output
# Defaults!/usr/bin/sudoreplay !log_output
# Defaults!/usr/local/bin/sudoreplay !log_output
# Defaults!/sbin/reboot !log_output

##
## Runas alias specification
##

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

## Uncomment to allow members of group wheel to execute any command
# %wheel ALL=(ALL) ALL

## Same thing without a password
# %wheel ALL=(ALL) NOPASSWD: ALL

## Uncomment to allow members of group sudo to execute any command
# %sudo    ALL=(ALL) ALL

## Uncomment to allow any user to run sudo if they know the password
## of the user they are running the command as (root by default).
#Defaults targetpw  # Ask for the password of the target user
# ALL ALL=(ALL) ALL  # WARNING: only use this together with 'Defaults targetpw'

## Read drop-in files from /etc/sudoers.d
## (the '#' here does not indicate a comment)
#includedir /etc/sudoers.d 

Last edited by nhianho (2011-09-24 21:54:49)


My favorite Linux sites: Distrowatch, Tux machines, Linux and Life,

Offline

#2 2011-09-24 22:37:51

oliver
Administrator
Registered: 2010-11-04
Posts: 2,209

Re: [Solved] sudo doesn't ask for password

can you post the output of "sudo -l" as the user you're having the problem with? (that is a dash ell, not dash one)

Offline

#3 2011-09-24 23:29:27

nhianho
Member
Registered: 2011-08-05
Posts: 30

Re: [Solved] sudo doesn't ask for password

User **** may run the following commands on this host:
    (ALL) ALL
    (ALL) NOPASSWD: ALL 

My favorite Linux sites: Distrowatch, Tux machines, Linux and Life,

Offline

#4 2011-09-25 00:26:43

Mr Green
Administrator
Registered: 2010-11-07
Posts: 6,920

Re: [Solved] sudo doesn't ask for password


Comments, suggestions please feel free to contact me mrgreen(at)archbang(dot)org

Offline

#5 2011-09-25 02:00:51

ArchVortex
Retired
From: Ts’elxweyeqw, Canada
Registered: 2011-04-01
Posts: 1,465

Re: [Solved] sudo doesn't ask for password

I've seen others have the same problem when directly adding your user name to sudoers instead of using the group wheel.

If you added your name to group wheel

useradd -m -g users -G audio,lp,optical,storage,video,wheel,games,power -s /bin/bash yourusername

# passwd yourusername

and uncommented

%wheel ALL=(ALL) ALL

then you will need to use sudo to perform root privileges.


You have the capacity to learn from mistakes. You'll learn a lot today.
FP:E5F8 7DBA 8128 9ACB 75F7 7279 BE34 AB66 76D9 16DE
KEY ID:76D916DE
Currently running ArchBang / LFS / OpenSUSE Tumbleweed

Offline

#6 2011-09-25 02:27:49

Mr Green
Administrator
Registered: 2010-11-07
Posts: 6,920

Re: [Solved] sudo doesn't ask for password

Would it be worth blacklisting sudo package during install? that way user if forced to install and set up


Comments, suggestions please feel free to contact me mrgreen(at)archbang(dot)org

Offline

#7 2011-09-25 02:32:48

ArchVortex
Retired
From: Ts’elxweyeqw, Canada
Registered: 2011-04-01
Posts: 1,465

Re: [Solved] sudo doesn't ask for password

Just reading the sudoers manual and if you add

 Defaults insults

to your sudoers it will insult you if you put the wrong password in while using sudo. Not a solution to the problem but I think it's amusing lol


You have the capacity to learn from mistakes. You'll learn a lot today.
FP:E5F8 7DBA 8128 9ACB 75F7 7279 BE34 AB66 76D9 16DE
KEY ID:76D916DE
Currently running ArchBang / LFS / OpenSUSE Tumbleweed

Offline

#8 2011-09-25 02:33:38

nhianho
Member
Registered: 2011-08-05
Posts: 30

Re: [Solved] sudo doesn't ask for password

archvortex wrote:

I've seen others have the same problem when directly adding your user name to sudoers instead of using the group wheel.

If you added your name to group wheel

useradd -m -g users -G audio,lp,optical,storage,video,wheel,games,power -s /bin/bash yourusername

# passwd yourusername

and uncommented

%wheel ALL=(ALL) ALL

then you will need to use sudo to perform root privileges.

So it means I should comment the line USER_NAME   ALL=(ALL) ALL and add my username to wheel group instead ?


My favorite Linux sites: Distrowatch, Tux machines, Linux and Life,

Offline

#9 2011-09-25 03:09:22

ArchVortex
Retired
From: Ts’elxweyeqw, Canada
Registered: 2011-04-01
Posts: 1,465

Re: [Solved] sudo doesn't ask for password

nhianho wrote:

when I run any command at root, it doesnt ask me for password anymore. How to fix ?

DOH!! If I'm reading this right, you only need to use sudo and password when you are using your username to become root. Once you are root you don't need a password anymore.

BTW, your sudoers file looks correct according to the Wiki.


You have the capacity to learn from mistakes. You'll learn a lot today.
FP:E5F8 7DBA 8128 9ACB 75F7 7279 BE34 AB66 76D9 16DE
KEY ID:76D916DE
Currently running ArchBang / LFS / OpenSUSE Tumbleweed

Offline

#10 2011-09-25 06:03:05

nhianho
Member
Registered: 2011-08-05
Posts: 30

Re: [Solved] sudo doesn't ask for password

archvortex wrote:
nhianho wrote:

when I run any command at root, it doesnt ask me for password anymore. How to fix ?

DOH!! If I'm reading this right, you only need to use sudo and password when you are using your username to become root. Once you are root you don't need a password anymore.

BTW, your sudoers file looks correct according to the Wiki.

no, my problem is that, even if I run sudo as a casual user, it still doesnt ask for password.


My favorite Linux sites: Distrowatch, Tux machines, Linux and Life,

Offline

#11 2011-09-25 07:25:46

ArchVortex
Retired
From: Ts’elxweyeqw, Canada
Registered: 2011-04-01
Posts: 1,465

Re: [Solved] sudo doesn't ask for password

Okay, then yes, comment the line USER_NAME   ALL=(ALL) ALL and add your username to wheel group instead. It should work without any problems. Don't see why something like

nhianho ALL=(ALL) ALL

wouldn't work if your username was added. According to the Arch Wiki it should be ok. But, like I said, I've seen Arch users complain about your problem in the past. Hmmmm?


You have the capacity to learn from mistakes. You'll learn a lot today.
FP:E5F8 7DBA 8128 9ACB 75F7 7279 BE34 AB66 76D9 16DE
KEY ID:76D916DE
Currently running ArchBang / LFS / OpenSUSE Tumbleweed

Offline

#12 2011-09-25 07:57:25

oliver
Administrator
Registered: 2010-11-04
Posts: 2,209

Re: [Solved] sudo doesn't ask for password

nhianho wrote:
User **** may run the following commands on this host:
    (ALL) ALL
    (ALL) NOPASSWD: ALL 

something doesn't add up here... the sudoers file you posted doesn't include a directive with "NOPASSWD" but your user clearly is set up that way.  Instead of looking at the sudoers.tmp file, what does /etc/sudoers say (you need to be root (or sudo root) to see it :-) )

# grep -v ^# /etc/sudoers

Offline

#13 2011-09-25 08:38:17

nhianho
Member
Registered: 2011-08-05
Posts: 30

Re: [Solved] sudo doesn't ask for password

here is my /etc/sudoers

## sudoers file.
##
## This file MUST be edited with the 'visudo' command as root.
## Failure to use 'visudo' may result in syntax or file permission errors
## that prevent sudo from running.
##
## See the sudoers man page for the details on how to write a sudoers file.
##

##
## Host alias specification
##
## Groups of machines. These may include host names (optionally with wildcards),
## IP addresses, network numbers or netgroups.
# Host_Alias    WEBSERVERS = www1, www2, www3

##
## User alias specification
##
## Groups of users.  These may consist of user names, uids, Unix groups,
## or netgroups.
# User_Alias    ADMINS = millert, dowdy, mikef

##
## Cmnd alias specification
##
## Groups of commands.  Often used to group related commands together.
# Cmnd_Alias    PROCESSES = /usr/bin/nice, /bin/kill, /usr/bin/renice, \
#                 /usr/bin/pkill, /usr/bin/top

##
## Defaults specification
##
## You may wish to keep some of the following environment variables
## when running commands via sudo.
##
## Locale settings
# Defaults env_keep += "LANG LANGUAGE LINGUAS LC_* _XKB_CHARSET"
##
## Run X applications through sudo; HOME is used to find the
## .Xauthority file.  Note that other programs use HOME to find   
## configuration files and this may lead to privilege escalation!
# Defaults env_keep += "HOME"
##
## X11 resource path settings
# Defaults env_keep += "XAPPLRESDIR XFILESEARCHPATH XUSERFILESEARCHPATH"
##
## Desktop path settings
# Defaults env_keep += "QTDIR KDEDIR"
##
## Allow sudo-run commands to inherit the callers' ConsoleKit session
# Defaults env_keep += "XDG_SESSION_COOKIE"
##
## Uncomment to enable special input methods.  Care should be taken as
## this may allow users to subvert the command being run via sudo.
# Defaults env_keep += "XMODIFIERS GTK_IM_MODULE QT_IM_MODULE QT_IM_SWITCHER"
##
## Uncomment to enable logging of a command's output, except for
## sudoreplay and reboot.  Use sudoreplay to play back logged sessions.
# Defaults log_output
# Defaults!/usr/bin/sudoreplay !log_output
# Defaults!/usr/local/bin/sudoreplay !log_output
# Defaults!/sbin/reboot !log_output

##
## Runas alias specification
##

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

## Uncomment to allow members of group wheel to execute any command
# %wheel ALL=(ALL) ALL

## Same thing without a password
# %wheel ALL=(ALL) NOPASSWD: ALL

## Uncomment to allow members of group sudo to execute any command
# %sudo    ALL=(ALL) ALL

## Uncomment to allow any user to run sudo if they know the password
## of the user they are running the command as (root by default).
#Defaults targetpw  # Ask for the password of the target user
# ALL ALL=(ALL) ALL  # WARNING: only use this together with 'Defaults targetpw'

## Read drop-in files from /etc/sudoers.d
## (the '#' here does not indicate a comment)
#includedir /etc/sudoers.d

My favorite Linux sites: Distrowatch, Tux machines, Linux and Life,

Offline

#14 2011-09-25 08:46:20

ArchVortex
Retired
From: Ts’elxweyeqw, Canada
Registered: 2011-04-01
Posts: 1,465

Re: [Solved] sudo doesn't ask for password

On a fresh install it should only show:

 root ALL=(ALL) ALL 

with

# grep -v ^# /etc/sudoers
nhianho wrote:

I used visudo to give sudo privilege to my casual user name


What command was written to add the casual user? Something like this:

# useradd -m -g [initial_group] -G [additional_groups] -s [login_shell] [username] 

which would look something like this

# useradd -m -g users -G audio,lp,optical,storage,video,wheel,games,power -s /bin/bash ahab

Or did you just add ahab to /etc/sudoers without adding the user first with the above command? Just trying to eliminate possibilities.


You have the capacity to learn from mistakes. You'll learn a lot today.
FP:E5F8 7DBA 8128 9ACB 75F7 7279 BE34 AB66 76D9 16DE
KEY ID:76D916DE
Currently running ArchBang / LFS / OpenSUSE Tumbleweed

Offline

#15 2011-09-26 02:58:39

nhianho
Member
Registered: 2011-08-05
Posts: 30

Re: [Solved] sudo doesn't ask for password

archvortex wrote:

On a fresh install it should only show:

 root ALL=(ALL) ALL 

with

# grep -v ^# /etc/sudoers
nhianho wrote:

I used visudo to give sudo privilege to my casual user name


What command was written to add the casual user? Something like this:

# useradd -m -g [initial_group] -G [additional_groups] -s [login_shell] [username] 

which would look something like this

# useradd -m -g users -G audio,lp,optical,storage,video,wheel,games,power -s /bin/bash ahab

Or did you just add ahab to /etc/sudoers without adding the user first with the above command? Just trying to eliminate possibilities.

after installed archbang successfully, I just ran visudo with nano and add "myusername ALL = (ALL) ALL" , this worked well with the former version of archbang but dont know why this problem occurs now.


My favorite Linux sites: Distrowatch, Tux machines, Linux and Life,

Offline

#16 2011-09-27 02:23:07

nhianho
Member
Registered: 2011-08-05
Posts: 30

Re: [Solved] sudo doesn't ask for password

something is terribly wrong here, I removed the line

 myusername ALL =(ALL) ALL

And also added PASSWD tags but I still can run sudo without password confirmation as a local user. What to do now?

Here is my new sudoers file

## sudoers file.
##
## This file MUST be edited with the 'visudo' command as root.
## Failure to use 'visudo' may result in syntax or file permission errors
## that prevent sudo from running.
##
## See the sudoers man page for the details on how to write a sudoers file.
##

##
## Host alias specification
##
## Groups of machines. These may include host names (optionally with wildcards),
## IP addresses, network numbers or netgroups.
# Host_Alias    WEBSERVERS = www1, www2, www3

##
## User alias specification
##
## Groups of users.  These may consist of user names, uids, Unix groups,
## or netgroups.
# User_Alias    ADMINS = millert, dowdy, mikef

##
## Cmnd alias specification
##
## Groups of commands.  Often used to group related commands together.
# Cmnd_Alias    PROCESSES = /usr/bin/nice, /bin/kill, /usr/bin/renice, \
#                 /usr/bin/pkill, /usr/bin/top

##
## Defaults specification
##
## You may wish to keep some of the following environment variables
## when running commands via sudo.
##
## Locale settings
# Defaults env_keep += "LANG LANGUAGE LINGUAS LC_* _XKB_CHARSET"
##
## Run X applications through sudo; HOME is used to find the
## .Xauthority file.  Note that other programs use HOME to find   
## configuration files and this may lead to privilege escalation!
# Defaults env_keep += "HOME"
##
## X11 resource path settings
# Defaults env_keep += "XAPPLRESDIR XFILESEARCHPATH XUSERFILESEARCHPATH"
##
## Desktop path settings
# Defaults env_keep += "QTDIR KDEDIR"
##
## Allow sudo-run commands to inherit the callers' ConsoleKit session
# Defaults env_keep += "XDG_SESSION_COOKIE"
##
## Uncomment to enable special input methods.  Care should be taken as
## this may allow users to subvert the command being run via sudo.
# Defaults env_keep += "XMODIFIERS GTK_IM_MODULE QT_IM_MODULE QT_IM_SWITCHER"
##
## Uncomment to enable logging of a command's output, except for
## sudoreplay and reboot.  Use sudoreplay to play back logged sessions.
# Defaults log_output
# Defaults!/usr/bin/sudoreplay !log_output
# Defaults!/usr/local/bin/sudoreplay !log_output
# Defaults!/sbin/reboot !log_output

##
## Runas alias specification
##

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

## Uncomment to allow members of group wheel to execute any command
# %wheel ALL=(ALL) PASSWD: ALL

## Same thing without a password
# %wheel ALL=(ALL) PASSWD: ALL

## Uncomment to allow members of group sudo to execute any command
# %sudo    ALL=(ALL) PASSWD: ALL

## Uncomment to allow any user to run sudo if they know the password
## of the user they are running the command as (root by default).
## Defaults targetpw  # Ask for the password of the target user
## ALL ALL=(ALL) ALL  # WARNING: only use this together with 'Defaults targetpw'

## Read drop-in files from /etc/sudoers.d
## (the '#' here does not indicate a comment)
#includedir /etc/sudoers.d

Last edited by nhianho (2011-09-27 02:24:40)


My favorite Linux sites: Distrowatch, Tux machines, Linux and Life,

Offline

#17 2011-09-27 02:33:07

ArchVortex
Retired
From: Ts’elxweyeqw, Canada
Registered: 2011-04-01
Posts: 1,465

Re: [Solved] sudo doesn't ask for password

Did you run visudo as root or as user? If you visudo

# visudo

as root then there should be no problem. I just did it without any problems. If you did it as root and it doesn't work, I'm out of ideas.


You have the capacity to learn from mistakes. You'll learn a lot today.
FP:E5F8 7DBA 8128 9ACB 75F7 7279 BE34 AB66 76D9 16DE
KEY ID:76D916DE
Currently running ArchBang / LFS / OpenSUSE Tumbleweed

Offline

#18 2011-09-27 04:47:28

Mr Green
Administrator
Registered: 2010-11-07
Posts: 6,920

Re: [Solved] sudo doesn't ask for password

Maybe this may help

EDITOR=nano visudo

now you can edit using nano which is a little easier to use

Sorry if this confuses issue


Comments, suggestions please feel free to contact me mrgreen(at)archbang(dot)org

Offline

#19 2011-09-27 05:11:34

ArchVortex
Retired
From: Ts’elxweyeqw, Canada
Registered: 2011-04-01
Posts: 1,465

Re: [Solved] sudo doesn't ask for password

@Mr Green, that's a good point. Does ArchBang automatically EDITOR=nano visudo during the installation process or do you have to manually EDITOR=nano visudo like in an Arch installation? I'm assuming it automatically does it because if I # visudo it opens in nano and not in vi and I haven't done EDITOR=nano visudo.

Bottom line: I always "useradd -m -g [initial_group] -G [additional_groups] -s [login_shell] [username]"  to add users to the wheel group and never directly add to the sudoers list. I remember a few years ago some users having problems similar to nhianho and I don't remember whether they solved their problem or not. One thing is, you need to edit sudoers as root for it to work.


You have the capacity to learn from mistakes. You'll learn a lot today.
FP:E5F8 7DBA 8128 9ACB 75F7 7279 BE34 AB66 76D9 16DE
KEY ID:76D916DE
Currently running ArchBang / LFS / OpenSUSE Tumbleweed

Offline

#20 2011-09-27 07:31:12

oliver
Administrator
Registered: 2010-11-04
Posts: 2,209

Re: [Solved] sudo doesn't ask for password

nhianho wrote:

something is terribly wrong here, I removed the line

 myusername ALL =(ALL) ALL

And also added PASSWD tags but I still can run sudo without password confirmation as a local user. What to do now?

Can you run this (as the problematic user):

alias | grep sudo

which sudo

Also, try moving sudoers to /etc/sudoers_test and running the following (as the user)

sudo -k
sudo -ll

Make sure you know your root password before continuing or leave another root shell open in the background

Offline

#21 2011-09-27 09:10:24

Mr Green
Administrator
Registered: 2010-11-07
Posts: 6,920

Re: [Solved] sudo doesn't ask for password

@archvortex visudo opens in vi [iso RC2] as does install .... so switching editor would help new users [well be less difficult!]

Contents of sudoers file is really down to the user, maybe reinstalling the package will give him a clean start as it sounds like its all gone nuts!

It is interesting that Archbang gives full permissions without password, I know I am going to use dd one day and then you will hear me crying in the corner....

Sudo is handy but I would prefer to be asked for a password [on my todo list!]

Last edited by Mr Green (2011-09-27 09:11:02)


Comments, suggestions please feel free to contact me mrgreen(at)archbang(dot)org

Offline

#22 2011-09-27 10:24:18

ArchVortex
Retired
From: Ts’elxweyeqw, Canada
Registered: 2011-04-01
Posts: 1,465

Re: [Solved] sudo doesn't ask for password

My bad! That was me opening /etc/sudoer with nano just to look at it. DOH!! Wall.gif

I'm worried too if a user can do stuff to their system or someone's system without permission/needing to be root. I think Will needs to look into if this is the case with this RC and what is causing it if this isn't a one time glitch for one user. And I agree about sudo....I would uninstall/reinstall to see if that fixes the problem.

Really strange. I could use visudo as a user this afternoon but now I can only do it as root (which is how it should be, shouldn't it?)


You have the capacity to learn from mistakes. You'll learn a lot today.
FP:E5F8 7DBA 8128 9ACB 75F7 7279 BE34 AB66 76D9 16DE
KEY ID:76D916DE
Currently running ArchBang / LFS / OpenSUSE Tumbleweed

Offline

#23 2011-09-27 11:38:22

ArchVortex
Retired
From: Ts’elxweyeqw, Canada
Registered: 2011-04-01
Posts: 1,465

Re: [Solved] sudo doesn't ask for password

Just curious, if you use su instead of sudo what happens?

See if this helps:

https://bbs.archlinux.org/viewtopic.php?id=37415

If it is this then you want to do this:

https://wiki.archlinux.org/index.php/Su … he_timeout

found this too:

http://www.sudo.ws/pipermail/sudo-users … 04436.html


You have the capacity to learn from mistakes. You'll learn a lot today.
FP:E5F8 7DBA 8128 9ACB 75F7 7279 BE34 AB66 76D9 16DE
KEY ID:76D916DE
Currently running ArchBang / LFS / OpenSUSE Tumbleweed

Offline

#24 2011-09-27 19:52:34

nhianho
Member
Registered: 2011-08-05
Posts: 30

Re: [Solved] sudo doesn't ask for password

archvortex wrote:

Just curious, if you use su instead of sudo what happens?

See if this helps:

https://bbs.archlinux.org/viewtopic.php?id=37415

If it is this then you want to do this:

https://wiki.archlinux.org/index.php/Su … he_timeout

found this too:

http://www.sudo.ws/pipermail/sudo-users … 04436.html

I added timestamp_timeout = 0 to the sudoers but the problem still remains

Here is my current sudoers

 ## sudoers file.
##
## This file MUST be edited with the 'visudo' command as root.
## Failure to use 'visudo' may result in syntax or file permission errors
## that prevent sudo from running.
##
## See the sudoers man page for the details on how to write a sudoers file.
##

##
## Host alias specification
##
## Groups of machines. These may include host names (optionally with wildcards),
## IP addresses, network numbers or netgroups.
# Host_Alias    WEBSERVERS = www1, www2, www3

##
## User alias specification
##
## Groups of users.  These may consist of user names, uids, Unix groups,
## or netgroups.
# User_Alias    ADMINS = millert, dowdy, mikef

##
## Cmnd alias specification
##
## Groups of commands.  Often used to group related commands together.
# Cmnd_Alias    PROCESSES = /usr/bin/nice, /bin/kill, /usr/bin/renice, \
#                 /usr/bin/pkill, /usr/bin/top

##
## Defaults specification
##
## You may wish to keep some of the following environment variables
## when running commands via sudo.
##
## Locale settings
# Defaults env_keep += "LANG LANGUAGE LINGUAS LC_* _XKB_CHARSET"
##
## Run X applications through sudo; HOME is used to find the
## .Xauthority file.  Note that other programs use HOME to find   
## configuration files and this may lead to privilege escalation!
# Defaults env_keep += "HOME"
##
## X11 resource path settings
# Defaults env_keep += "XAPPLRESDIR XFILESEARCHPATH XUSERFILESEARCHPATH"
##
## Desktop path settings
# Defaults env_keep += "QTDIR KDEDIR"
##
## Allow sudo-run commands to inherit the callers' ConsoleKit session
# Defaults env_keep += "XDG_SESSION_COOKIE"
##
## Uncomment to enable special input methods.  Care should be taken as
## this may allow users to subvert the command being run via sudo.
# Defaults env_keep += "XMODIFIERS GTK_IM_MODULE QT_IM_MODULE QT_IM_SWITCHER"
##
## Uncomment to enable logging of a command's output, except for
## sudoreplay and reboot.  Use sudoreplay to play back logged sessions.
# Defaults log_output
# Defaults!/usr/bin/sudoreplay !log_output
# Defaults!/usr/local/bin/sudoreplay !log_output
# Defaults!/sbin/reboot !log_output

##
## Runas alias specification
##

##
## User privilege specification
##
root ALL= (ALL) PASSWD: ALL
my-user-name ALL= (ALL) PASSWD: ALL

Defaults:my-user-name timestamp_timeout=0

## Uncomment to allow members of group wheel to execute any command
# %wheel ALL=(ALL) PASSWD: ALL

## Same thing without a password
# %wheel ALL=(ALL) PASSWD: ALL

## Uncomment to allow members of group sudo to execute any command
# %sudo    ALL=(ALL) PASSWD: ALL

## Uncomment to allow any user to run sudo if they know the password
## of the user they are running the command as (root by default).
## Defaults targetpw  # Ask for the password of the target user
## ALL ALL=(ALL) ALL  # WARNING: only use this together with 'Defaults targetpw'

## Read drop-in files from /etc/sudoers.d
## (the '#' here does not indicate a comment)
#includedir /etc/sudoers.d 

My favorite Linux sites: Distrowatch, Tux machines, Linux and Life,

Offline

#25 2011-09-27 20:06:54

willxtreme
The Cook
From: Longueuil, Quebec, Canada
Registered: 2010-10-06
Posts: 275

Re: [Solved] sudo doesn't ask for password

Did you try deleting /etc/sudoers.d/g_wheel ?

Offline

#26 2011-09-29 23:09:48

nhianho
Member
Registered: 2011-08-05
Posts: 30

Re: [Solved] sudo doesn't ask for password

willxtreme wrote:

Did you try deleting /etc/sudoers.d/g_wheel ?

No, I didnt. After install the newest Archbang, I ran " EDITOR=nano visudo" then added the line "my-user-name ALL = (ALL) ALL" then the problem occured. Even after I deleted this line and added PASSWD tags, the problem still remains.


My favorite Linux sites: Distrowatch, Tux machines, Linux and Life,

Offline

#27 2011-09-29 23:37:19

Mr Green
Administrator
Registered: 2010-11-07
Posts: 6,920

Re: [Solved] sudo doesn't ask for password

Post the name of the file and location you are editing?.....


Comments, suggestions please feel free to contact me mrgreen(at)archbang(dot)org

Offline

#28 2011-09-30 14:04:17

Mr Green
Administrator
Registered: 2010-11-07
Posts: 6,920

Re: [Solved] sudo doesn't ask for password

I managed to get sudo working with a password only to find I could not shutdown or reboot....Now need to sort oblogout

%wheel ALL = NOPASSWD: /sbin/shutdown

sorted!

Last edited by Mr Green (2011-09-30 14:11:02)


Comments, suggestions please feel free to contact me mrgreen(at)archbang(dot)org

Offline

#29 2011-09-30 21:09:09

oliver
Administrator
Registered: 2010-11-04
Posts: 2,209

Re: [Solved] sudo doesn't ask for password

nhianho wrote:
willxtreme wrote:

Did you try deleting /etc/sudoers.d/g_wheel ?

No, I didnt. After install the newest Archbang, I ran " EDITOR=nano visudo" then added the line "my-user-name ALL = (ALL) ALL" then the problem occured. Even after I deleted this line and added PASSWD tags, the problem still remains.

This fix has been posted in another thread... take a look at the /etc/sudoers.d/g_wheel file and remove the NOPASSWD bit (or the file altogether if you're happy with maintaining usernames in the main sudoers file)

Offline

#30 2011-10-01 02:30:46

Lennie
Member
From: Sweden
Registered: 2011-09-30
Posts: 16

Re: [Solved] sudo doesn't ask for password

I had the same problem. In my case the problem was /etc/sudoers.d/g_wheel . It said:
%wheel ALL=(ALL) NOPASSWD: ALL

I changed that to:
%wheel  ALL=(ALL) ALL
username  ALL=(ALL) NOPASSWD: /sbin/shutdown
username  ALL=(ALL) NOPASSWD: /sbin/reboot

I needed to press enter after the last line, otherwise I got "syntax error" when I ran a sudo command.

Now sudo asks for my password, and I can also shutdown my computer.

Offline

#31 2011-10-01 08:35:22

nhianho
Member
Registered: 2011-08-05
Posts: 30

Re: [Solved] sudo doesn't ask for password

Lennie wrote:

I had the same problem. In my case the problem was /etc/sudoers.d/g_wheel . It said:
%wheel ALL=(ALL) NOPASSWD: ALL

I changed that to:
%wheel  ALL=(ALL) ALL
username  ALL=(ALL) NOPASSWD: /sbin/shutdown
username  ALL=(ALL) NOPASSWD: /sbin/reboot

I needed to press enter after the last line, otherwise I got "syntax error" when I ran a sudo command.

Now sudo asks for my password, and I can also shutdown my computer.

thanks. Problem solved.


My favorite Linux sites: Distrowatch, Tux machines, Linux and Life,

Offline

#32 2011-11-10 04:48:52

once
Member
Registered: 2011-03-13
Posts: 127

Re: [Solved] sudo doesn't ask for password

2k11.11 install, still sudo didnt ask passwd.

Offline

#33 2011-11-10 07:37:23

oliver
Administrator
Registered: 2010-11-04
Posts: 2,209

Re: [Solved] sudo doesn't ask for password

once wrote:

2k11.11 install, still sudo didnt ask passwd.

It's by design... users in the wheel group inherit the sudoers.d/g_wheel permissions which allow all as root with no password

Offline

#34 2012-01-30 10:00:37

!lix
Member
Registered: 2011-10-25
Posts: 8

Re: [Solved] sudo doesn't ask for password

hi, i've got the same problem, sudo didn't ask me password, but i've solved modifying /etc/sodoers.d/g_wheel like lennie said!
but now i've got a little problem with pcmanfm, tools>open_current_folder_as_root doesn't work!
any ideas?

thanks igor

Offline

#35 2012-01-30 16:10:22

!lix
Member
Registered: 2011-10-25
Posts: 8

Re: [Solved] sudo doesn't ask for password

hi, i've solved this problem too! i've installed gksu, and then pcmandfm>edit>preferences>advanced.
switch user command: gksudo %s

igor

Offline

#36 2012-02-01 11:06:27

doug piston
Member
Registered: 2011-12-18
Posts: 64

Re: [Solved] sudo doesn't ask for password

I had this issues as well but though nothing of it, basically saw it as one less step for me. Regardless I figured I should change it and rm'd the g_wheel. Now I can't shut down. o.O Oops. So it seems lennie's method is the best. So i guess I will recreate the the g_wheel when I get home this evening. smile

Offline

#37 2012-04-03 12:22:08

distrohopperarched
Member
Registered: 2012-01-30
Posts: 104

Re: [Solved] sudo doesn't ask for password

doug piston wrote:

I had this issues as well but though nothing of it, basically saw it as one less step for me.

Exactly. I'm also affected and I'm not sure if I care. Is this security wise relevant ? As in, does it make my box weaker or can I keep things as is if I pay attention ?

Offline

Board footer

Powered by FluxBB