[Pkg-shadow-devel] Bug#528060: Can't delete user: user is currently logged in

Nicolas François nicolas.francois at centraliens.net
Sun May 10 16:40:51 UTC 2009


Hello,

On Sun, May 10, 2009 at 05:29:28PM +0200, lool at dooz.org wrote:
> 
>  Following these steps, I systematically am prevented to deluser foobar:
>  - on tty1 as root, adduser foobar, password foo
>  - on tty2, login as foobar/foo, then ^D to logout
>  - on tty1 as root, deluser foobar:
>     Removing user `foobar' ...
>     Warning: group `foobar' has no more members.
>     userdel: user foobar is currently logged in
>     /usr/sbin/deluser: `/usr/sbin/userdel foobar' returned error code 8. Exiting.

I cannot reproduce it.

I just remember already reading about this kind of bug, so it would be
nice to have more information.

Did you make changes in one of:
/etc/login.defs
/etc/pam.d/login
/etc/pam.d/common-session
(and maybe some other pam.d files)

>  I reproduce with "userdel foobar" and if I strace it, I see one of the
>  last actions before the message is to open /var/run/utmp.
> 
>  pgrep -u foobar yields no process and "who" and "w" don't show any
>  session from foobar; "last foobar" doesn't show this user as logged in
>  either.
> 
>  If I login on tty2 with another user, I can deluser foobar.
> 
>  I suspect the parsing of utmp is broken since both w and who get it
>  right.

it would be nice to get the utmp entry for tty2.

Can check with the attached C file, after you have logged out foobar?


Best Regards,
-- 
Nekral
-------------- next part --------------
A non-text attachment was scrubbed...
Name: test_utmp.c
Type: text/x-csrc
Size: 724 bytes
Desc: not available
URL: <http://lists.alioth.debian.org/pipermail/pkg-shadow-devel/attachments/20090510/c98570e4/attachment.c>


More information about the Pkg-shadow-devel mailing list