number of users: a solution

Peter Garrett peter.garrett at optusnet.com.au
Wed Aug 24 05:53:35 UTC 2005


On Tue, 23 Aug 2005 22:15:56 +0200
Sebastien Braun <sebb at yellowhippy.org> wrote:

> Hi all,
> 
> I have lurked this list for quite some time now, but thought I might be of 
> help here, so I'll just chime in (english is not my native language, so 
> forgive me if I misunderstood something):
> 
> Am Montag, 22. August 2005 21:20 schrieb Derek Broughton:
> > Vram wrote:
> > >
> > > man who
> > >
> > > man users
> >
> > Not at all.  I know what they do - the question is why is a konsole
> > terminal different from an xterm, for the purposes of who and users.
> 
> who and users do _not_ show you who is currently logged in. They are just 
> programs for formatting /var/run/utmp in a readable way. They can also show 
> you other files, namely /var/log/wtmp, which records past utmp entries.
> 
> For a program to be able to record its entries in utmp, root privileges are 
> needed. kdm obviously has them, so does /sbin/login, which is responsible for 
> the terminal logins. Konsole, however, does not. It relies on a daemon called 
> utempter to do the utmp updating for it. I was not able to find utempter in 
> apt, so chances are that ubuntu does not support konsole showing up in who.
> 
> Googling for utempter might turn up useful information.
> 
> Cheers,
> Sebastien
> 

OK - I had a look at two terminals that show the differing behaviour we have been discussing...

peter at prospero:~$ ls -l /usr/bin/aterm
lrwxrwxrwx  1 root root 23 2005-05-05 09:07 /usr/bin/aterm -> /etc/alternatives/aterm

peter at prospero:~$ ls -l /usr/bin/aterm-xterm 
-rwxr-sr-x  1 root utmp 101592 2004-08-14 05:40 /usr/bin/aterm-xterm
         ^                ^^^^

peter at prospero:~$ ls -l /usr/bin/urxvt
-rwxr-xr-x  1 root root 180776 2005-03-21 21:51 /usr/bin/urxvt
        ^               ^^^

AHA!!  A light bulb goes on in my brain... so I do 

peter at prospero:~$ sudo chown root:utmp /usr/bin/urxvt
peter at prospero:~$ ls -l /usr/bin/urxvt
-rwxr-xr-x  1 root utmp 180776 2005-03-21 21:51 /usr/bin/urxvt

and 

peter at prospero:~$ sudo chmod g+s /usr/bin/urxvt
peter at prospero:~$ ls -l /usr/bin/urxvt
-rwxr-sr-x  1 root utmp 180776 2005-03-21 21:51 /usr/bin/urxvt

Now urxvt shows up and increments in the same manner as aterm.... !! 

I haven't tried this with konsole but I imagine something similar would do the trick

Hope this clears up some confusion.

Peter





-- 
Linux User #343161




More information about the ubuntu-users mailing list