Forums

Skip to content

Advanced search
  • Quick links
    • Unanswered topics
    • Active topics
    • Search
  • FAQ
  • Login
  • Register
  • Board index Assistance Desktop Environments
  • Search

[Solved] Sudo not working in Konsole (/dev/pts)

Problems with GUI applications? Questions about X, KDE, Gnome, Fluxbox, etc.? Come on in. NOTE: For multimedia, go up one forum
Post Reply
Advanced search
2 posts • Page 1 of 1
Author
Message
ShadowHawk92
n00b
n00b
Posts: 14
Joined: Mon Mar 04, 2013 3:15 am
Location: Texas, USA
Contact:
Contact ShadowHawk92
Website

[Solved] Sudo not working in Konsole (/dev/pts)

  • Quote

Post by ShadowHawk92 » Sat Mar 23, 2013 1:45 am

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: Select all

Defaults requiretty
Then changing it to:

Code: Select all

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: Select all

cp -a /dev/console /dev/tty
in the init script. I can't imagine this is the problem because running

Code: Select all

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: Select all

/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.
Top
teknocrust
n00b
n00b
Posts: 11
Joined: Sun Feb 03, 2013 9:18 pm

Fixed!

  • Quote

Post by teknocrust » Sat Apr 27, 2013 5:36 pm

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

Here is the fix

See here: https://forums.gentoo.org/viewtopic.php?p=7298374
Top
Post Reply

2 posts • Page 1 of 1

Return to “Desktop Environments”

Jump to
  • Assistance
  • ↳   News & Announcements
  • ↳   Frequently Asked Questions
  • ↳   Installing Gentoo
  • ↳   Multimedia
  • ↳   Desktop Environments
  • ↳   Networking & Security
  • ↳   Kernel & Hardware
  • ↳   Portage & Programming
  • ↳   Gamers & Players
  • ↳   Other Things Gentoo
  • ↳   Unsupported Software
  • Discussion & Documentation
  • ↳   Documentation, Tips & Tricks
  • ↳   Gentoo Chat
  • ↳   Gentoo Forums Feedback
  • ↳   Duplicate Threads
  • International Gentoo Users
  • ↳   中文 (Chinese)
  • ↳   Dutch
  • ↳   Finnish
  • ↳   French
  • ↳   Deutsches Forum (German)
  • ↳   Diskussionsforum
  • ↳   Deutsche Dokumentation
  • ↳   Greek
  • ↳   Forum italiano (Italian)
  • ↳   Forum di discussione italiano
  • ↳   Risorse italiane (documentazione e tools)
  • ↳   Polskie forum (Polish)
  • ↳   Instalacja i sprzęt
  • ↳   Polish OTW
  • ↳   Portuguese
  • ↳   Documentação, Ferramentas e Dicas
  • ↳   Russian
  • ↳   Scandinavian
  • ↳   Spanish
  • ↳   Other Languages
  • Architectures & Platforms
  • ↳   Gentoo on ARM
  • ↳   Gentoo on PPC
  • ↳   Gentoo on Sparc
  • ↳   Gentoo on Alternative Architectures
  • ↳   Gentoo on AMD64
  • ↳   Gentoo for Mac OS X (Portage for Mac OS X)
  • Board index
  • All times are UTC
  • Delete cookies

© 2001–2026 Gentoo Foundation, Inc.

Powered by phpBB® Forum Software © phpBB Limited

Privacy Policy