Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
[Solved] Sudo not working in Konsole (/dev/pts)
View unanswered posts
View posts from last 24 hours
View posts from last 7 days

 
Reply to topic    Gentoo Forums Forum Index Desktop Environments
View previous topic :: View next topic  
Author Message
ShadowHawk92
n00b
n00b


Joined: 04 Mar 2013
Posts: 14
Location: Texas, USA

PostPosted: Sat Mar 23, 2013 1:45 am    Post subject: [Solved] Sudo not working in Konsole (/dev/pts) Reply with quote

Solved Apparently it's a feature not a bug. Use sudo -S to read from stdin.

I have a strange problem with sudo.

Sudo works fine in tty, but not in Konsole (/dev/pts*). When I use sudo in Konsole, it appears to just hang for a minute or so until it times out.
Actually what's happening is it's prompting for my password in tty1 (ctl+alt+F1). I can switch over and type my password but the behavior there is strange too (I assume it will be fixed when sudo prompts in the appropriate tty).

I can (in Konsole) run:
sudo - and it will print the help text,
sudo -n <command> - and it will tell me that a password is required.
sudo <command> - IF %wheel ALL=(ALL) NOPASSWD: ALL is uncommented.
su -c <command>
I can not run:
sudo <command> - because of the password prompt problem,
sudo -l - it still prompts for password in the wrong tty.

I have messed around with my settings in visudo, notably adding:
Code:
Defaults requiretty

Then changing it to:
Code:
Defaults !requiretty

to no avail. I also uncommented and recommented Defaults env_keep += "HOME" and Defaults env_keep += "XDG_SESSION_COOKIE".
I have also changed some pam settings, but nothing made a difference.

The problem seems to be isolated in how sudo prompts for a password, and I can't figure out why.

Additional info:
I installed Gentoo on my (old) desktop before this as a test and installed XFCE on it. I had the same problem there too with Xterm and XFCE4-terminal.
The computer is booting from a custom initramfs I wrote (with a lot of help from the wiki) and in order to get gpg to work I have to run the command
Code:
cp -a /dev/console /dev/tty

in the init script. I can't imagine this is the problem because running
Code:
tty

prints tty1 in tty1 and pts{1,2,3,etc} in Konsole.

Here is my current /etc/sudoers. I can give pam config files if needed.

Code:
/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

## 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
#                           /usr/bin/pkill, /usr/bin/top
#

## 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

## Set timeout to 15 minutes
Defaults timestamp_timeout=15
## Keep display
Defaults env_keep += "DISPLAY"
## Require tty
Defaults !requiretty
## Adding insult to injury
Defaults insults


Edit: Spelling.
Update 2013-03-25: sudo -S prompts for password correctly. I can make an alias that works, but a non-alias solution is prefered.
Back to top
View user's profile Send private message
teknocrust
n00b
n00b


Joined: 03 Feb 2013
Posts: 11

PostPosted: Sat Apr 27, 2013 5:36 pm    Post subject: Fixed! Reply with quote

Hey all this same issue has been plaguing me forever!!

Here is the fix

See here: https://forums.gentoo.org/viewtopic.php?p=7298374
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Desktop Environments All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum