[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#611487: xterm: immediately exits upon running: exec login USER



On Sun, 13 Feb 2011, Jeffrey Sheinberg wrote:

Hi Thomas,

Here are some details on my setup,

# dpkg-query -l login xterm lxterminal xfce4-terminal
ii  login          1:4.1.4.2+svn3 system login tools
hi  xterm          235-2          X terminal emulator
ii  lxterminal     0.1.8-2        desktop independent vte-based terminal emula
ii  xfce4-terminal 0.4.5-1 Xfce   terminal emulator

aside from the xterm, I have the same versions here (of course I can
modify xterm).


# type login
login is /bin/login

# ls -l /bin/login
-rwsr-xr-x 1 root root 36896 Sep 25 18:05 /bin/login
; Notice that login is setuid to root, and is not setgid.

ok - shouldn't make much difference (I think).

;-----------------------------------------------------------------------
; Now I login from user jeff on pts/2 to user jsroot on same pts/2.
$ exec login jsroot
Password:
Last login: Fri Feb 11 08:42:34 EST 2011 on pts/3
....
# grep 'Feb 13 14:52:34 l2 login' /var/log/syslog
Feb 13 14:52:34 l2 login[6460]: pam_sm_authenticate: Called
Feb 13 14:52:34 l2 login[6460]: pam_sm_authenticate: username = [jsroot]
Feb 13 14:52:34 l2 login[6460]: pam_unix(login:session): session opened for user jsroot by jeff(uid=1001)
Feb 13 14:52:34 l2 login[6605]: ROOT LOGIN  on '/dev/pts/2' from ':0.0'

; So the above is successful using xterm 235-2.  Note that the above xterm has
; a PPID of 1 (init), since it was run from my $xclient, while the following
; VTEs have a PPID of 6461, which is the PID of the bash process that launched
; the VTE from pts/3.

ok (I'd be generally running all of those from the command-line, to simplify comparison).

on the machine I'm comparing at the moment, the pam messages are going to auth.log

syslog is only getting unrelated messages (including a bunch of segfaults from the kernel - that's 2.6.32-5-686, from an install of Debian/testing about a month ago).

;-----------------------------------------------------------------------
; Now startup xfce4-terminal (run from pts/3).
$ xfce4-terminal &
[1] 9545
   ; At this point an xfce4-terminal pops up, let $$ be its prompt.
   $$ exec login jsroot
   ; The xfce4-terminal now disappears, and there was no Password: prompt,
   ; and there was nothing in /var/log/syslog from login at this time.
$
[1]+  Done                    xfce4-terminal

; Now I startup lxterminal just like xfce4-terminal, and I get the same
; results as for xfce4-terminal - immediate exit on 'exec login jsroot',
; no Password: prompt, and nothing from login in the syslog.

That's consistent with what I was seeing.  But your comment in message #30
seemed to be saying that you got a prompt then.  I see the comment about
about the authentication messages from pam in the log - will check on that.

;-----------------------------------------------------------------------
; Now I just before install xterm 261-1, I try the same xfce4-terminal and
; lxterminal scenarios using instead xterm 235-2.
$ xterm &
[1] 10080
   ; At this point an xterm pops up, let $$ be its prompt
   $$ exec login jsroot
   Password:
   Last login: Sun Feb 13 17:20:51 EST 2011 on pts/6
; Back at the xterm on pts/3 where I just ran 'xterm &'.
$
   ; Now I exit from the xterm where I successfully logged in as jsroot
   $$
; Back again at the xterm  on pts/3 where I just ran 'xterm &'
$ Cannot chmod /dev/pts/6 to 666 currently 620: Operation not permitted
; Why does the above error message get output to pts/3?

The error message is written to xterm's stderr, which would be in the
shell from where it was launched.  The 666 would be when xterm's trying
to cleanup the pty permissions, and may be failing since the ownership
changed unexpectedly (from xterm's viewpoint, since it doesn't know about
login being setuid to root).

;
; Here are the syslog entries for this last login to jsroot,
Feb 13 17:26:17 l2 login[10081]: pam_sm_authenticate: Called
Feb 13 17:26:17 l2 login[10081]: pam_sm_authenticate: username = [jsroot]
Feb 13 17:26:17 l2 login[10081]: pam_unix(login:session): session opened for user jsroot by jeff(uid=1001)
Feb 13 17:26:17 l2 login[10153]: ROOT LOGIN  on '/dev/pts/6' from ':0.0'
Feb 13 17:29:22 l2 login[10081]: pam_unix(login:session): session closed for user jsroot

;-----------------------------------------------------------------------
; Now I install xterm 261-1.
# apt-get install xterm=261-1
....
Setting up xterm (261-1) ...
....
; Switch to pts/3, where I'll launch an xterm (261-1) in the background.
$ dpkg-query -l xterm
hi  xterm          261-1          X terminal emulator

$ who
jeff     tty1         Feb 13 14:37
jeff     pts/0        Feb 13 14:52 (:0.0)
jeff     pts/1        Feb 13 14:52 (:0.0)
jsroot   pts/2        Feb 13 14:52 (:0.0)
jeff     pts/3        Feb 13 14:52 (:0.0)
jsroot   pts/4        Feb 13 14:52 (:0.0)
jeff     pts/5        Feb 13 14:59 (:0.0)
$ xterm &
[1] 11422
   ; At this point an xterm pops up, let $$ be its prompt

   ; Switch to pts/6, where [1] 11422 is running in the background.
   $$ tty
   /dev/pts/6
   $$ logname
   jsroot
   ; Why is logname jsroot on pts/6?  May have something to do with having
   ; successfully done 'exec login jsroot' from xterm 235-2 on pts/6 in the
   ; first example above.

I'd assume it's looking at the pty and seeing the utmp record that was updated. But the "who" below should be using the same info (not sure yet).

   $$ who
   jeff     tty1         Feb 13 14:37
   jeff     pts/0        Feb 13 14:52 (:0.0)
   jeff     pts/1        Feb 13 14:52 (:0.0)
   jsroot   pts/2        Feb 13 14:52 (:0.0)
   jeff     pts/3        Feb 13 14:52 (:0.0)
   jsroot   pts/4        Feb 13 14:52 (:0.0)
   jeff     pts/5        Feb 13 14:59 (:0.0)
   jeff     pts/6        Feb 13 19:05 (:0.0)

   $$ exec login jsroot
   ; Xterm process on pts/6 exits, no login prompt, no entry in syslog,
   ; just like with xfce4-terminal and lxterminal.

; Back to pts/3.
$
[1]+  Done                    xterm
$ who
jeff     tty1         Feb 13 14:37
jeff     pts/0        Feb 13 14:52 (:0.0)
jeff     pts/1        Feb 13 14:52 (:0.0)
jsroot   pts/2        Feb 13 14:52 (:0.0)
jeff     pts/3        Feb 13 14:52 (:0.0)
jsroot   pts/4        Feb 13 14:52 (:0.0)
jeff     pts/5        Feb 13 14:59 (:0.0)

;-----------------------------------------------------------------------

If you can think of any other scenarios that you would like me to try,
I will be happy to do so.

I'll see what I can digest from this - thanks

--
Thomas E. Dickey
http://invisible-island.net
ftp://invisible-island.net



Reply to: