View previous topic :: View next topic |
Author |
Message |
l_bratch Guru
![Guru Guru](/images/ranks/rank_rect_3.gif)
Joined: 08 Feb 2005 Posts: 494 Location: Jersey
|
Posted: Thu Jun 04, 2009 11:06 pm Post subject: Correct way to see a list of connected clients |
|
|
Hi there,
What is the correct way to see a definite list of users connected to a Linux box? I'm aware of the who and w commands, but both of them don't seem to list everybody if there's more than one client logged into the same user account.
Here is an example taken from my server right now. There are two clients connected using SSH (82.32.208.16 and 87.244.88.177) who are both logged into the account bratch.
w says:
Code: | ~ $ w -f
23:58:30 up 1 day, 2:18, 2 users, load average: 0.25, 0.22, 0.16
USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT
bratch pts/1 82-32-208-16:S.0 Wed21 3:59 2:48 2:48 rtorrent
~ $ |
Who says:
Code: | ~ $ who
bratch pts/1 2009-06-03 21:40 (82-32-208-16:S.0)
~ $ |
Both seem to suggest that only one client is connected, but netstat confirms that there are two:
Code: | ~ $ netstat -np | grep :22
tcp 0 0 213.186.58.66:22 82.32.208.16:50819 ESTABLISHED7479/sshd: bratch
tcp 0 0 213.186.58.66:22 87.244.88.177:55791 ESTABLISHED23715/sshd: bratch
~ $ |
Thanks
l_bratch
P.S. Checking as root gives the same result. |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
gentoo_dude l33t
![l33t l33t](/images/ranks/rank_rect_4.gif)
![](images/avatars/gallery/Simpsons/Simpsons_-_Homer.jpg)
Joined: 08 May 2004 Posts: 645 Location: Washington, DC
|
Posted: Thu Jun 04, 2009 11:51 pm Post subject: |
|
|
for me who works:
Code: |
dstremtan@gentoodude ~ $ who
dstremtan tty1 Mar 20 07:17
dstremtan tty2 Jan 29 13:16
dstremtan tty3 May 6 18:05
dstremtan pts/0 Jun 4 19:44 (super-zen.stremtan.org)
dstremtan pts/1 Jun 4 19:46 (128.164.32.183)
|
try and see if you get a correct count, looks like when you run who, it runs with switch -m on. |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
gentoo_ram Guru
![Guru Guru](/images/ranks/rank_rect_3.gif)
Joined: 25 Oct 2007 Posts: 515 Location: San Diego, California USA
|
Posted: Fri Jun 05, 2009 6:30 am Post subject: |
|
|
'w' and 'who' show me connections over OpenSSH. What are your USE flags? You should post the output of 'emerge --info'. The USE flags I'm using for OpenSSH:
Code: | [ebuild R ] net-misc/openssh-5.2_p1-r1 USE="X pam tcpd -X509 -hpn -kerberos -ldap -libedit -pkcs11 (-selinux) -skey -smartcard -static" 67 kB
|
Is your 'pam' USE flag set? Maybe that will do it. I know for my KDE apps I need to include the USE flag 'utempter' on kdelibs to get 'w' and 'who' to work. |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
l_bratch Guru
![Guru Guru](/images/ranks/rank_rect_3.gif)
Joined: 08 Feb 2005 Posts: 494 Location: Jersey
|
Posted: Fri Jun 05, 2009 8:55 am Post subject: |
|
|
gentoo_dude: Running with -m shows the same thing.
who -q shows the wrong count (i.e. only 1 when there are 2 users).
Code: | [ebuild R ] net-misc/openssh-5.1_p1-r2 USE="pam tcpd -X -X509 -hpn -kerberos -ldap -libedit -pkcs11% (-selinux) -skey -smartcard -static" 1,060 kB | pam is already set.
Edit:
Ah, I think I know what is causing it, but still don't know what the solution is. If both users are connected to the same screen session (with screen -x), who and w only show one user. If one of the users disconnects from screen, who and w show both users!
I guess the question now is whether or not it's possible to get around that? On this particular server, multiple people are often in the same screen session - it's not some rare case that will never happen.
Edit2:
screen has a flag "multiuser", but enabling that didn't make any difference either.
emerge --info: Code: | # emerge --info
Portage 2.1.6.11 (default/linux/x86/2008.0, gcc-4.1.2, glibc-2.8_p20080602-r1, 2.6.28.4-xxxx-std-ipv4-32 i686)
=================================================================
System uname: Linux-2.6.28.4-xxxx-std-ipv4-32-i686-Intel-R-_Celeron-R-_CPU_2.60GHz-with-glibc2.0
Timestamp of tree: Wed, 27 May 2009 19:00:01 +0000
app-shells/bash: 3.2_p39
dev-lang/python: 2.4.4-r13, 2.5.2-r7
dev-python/pycrypto: 2.0.1-r6
sys-apps/baselayout: 1.12.11.1
sys-apps/sandbox: 1.6-r2
sys-devel/autoconf: 2.13, 2.63
sys-devel/automake: 1.7.9-r1, 1.10.2
sys-devel/binutils: 2.18-r3
sys-devel/gcc-config: 1.4.1
sys-devel/libtool: 1.5.26
virtual/os-headers: 2.6.27-r2
ACCEPT_KEYWORDS="x86"
CBUILD="i686-pc-linux-gnu"
CFLAGS="-O2 -march=i686 -pipe"
CHOST="i686-pc-linux-gnu"
CONFIG_PROTECT="/etc /var/bind"
CONFIG_PROTECT_MASK="/etc/ca-certificates.conf /etc/env.d /etc/gconf /etc/php/apache2-php5/ext-active/ /etc/php/cgi-php5/ext-active/ /etc/php/cli-php5/ext-active/ /etc/revd
ep-rebuild /etc/sandbox.d /etc/terminfo /etc/udev/rules.d"
CXXFLAGS="-O2 -march=i686 -pipe"
DISTDIR="/usr/portage/distfiles"
FEATURES="distlocks fixpackages parallel-fetch protect-owned sfperms strict unmerge-orphans userfetch"
GENTOO_MIRRORS="http://mirror.ovh.net/gentoo-distfiles/ ftp://mirror.ovh.net/gentoo-distfiles/"
LANG="en_GB"
LDFLAGS="-Wl,-O1"
MAKEOPTS="-j2"
PKGDIR="/usr/portage/packages"
PORTAGE_CONFIGROOT="/"
PORTAGE_RSYNC_OPTS="--recursive --links --safe-links --perms --times --compress --force --whole-file --delete --stats --timeout=180 --exclude=/distfiles --exclude=/local --
exclude=/packages"
PORTAGE_TMPDIR="/var/tmp"
PORTDIR="/usr/portage"
PORTDIR_OVERLAY="/usr/portage/local/layman/ovh-overlay /usr/portage/local/layman/sunrise"
SYNC="rsync://rsync.gentoo.org/gentoo-portage"
USE="acl apache2 berkdb bzip2 cli cracklib crypt cups dri fortran gdbm gpm iconv ipv6 isdnlog midi mmx mudflap mysql ncurses nls nptlonly openmp pam pcre perl php pppd pyth
on readline reflection sasl session spl sse sse2 ssl sysfs tcpd unicode x86 xorg zlib" ALSA_CARDS="ali5451 als4000 atiixp atiixp-modem bt87x ca0106 cmipci emu10k1 emu10k1x
ens1370 ens1371 es1938 es1968 fm801 hda-intel intel8x0 intel8x0m maestro3 trident usb-audio via82xx via82xx-modem ymfpci" ALSA_PCM_PLUGINS="adpcm alaw asym copy dmix dshare
dsnoop empty extplug file hooks iec958 ioplug ladspa lfloat linear meter mmap_emul mulaw multi null plug rate route share shm softvol" APACHE2_MODULES="actions alias auth_
basic authn_alias authn_anon authn_dbm authn_default authn_file authz_dbm authz_default authz_groupfile authz_host authz_owner authz_user autoindex cache dav dav_fs dav_loc
k deflate dir disk_cache env expires ext_filter file_cache filter headers include info log_config logio mem_cache mime mime_magic negotiation rewrite setenvif speling statu
s unique_id userdir usertrack vhost_alias" ELIBC="glibc" INPUT_DEVICES="keyboard mouse evdev" KERNEL="linux" LCD_DEVICES="bayrad cfontz cfontz633 glk hd44780 lb216 lcdm001
mtxorb ncurses text" USERLAND="GNU" VIDEO_CARDS="fbdev glint i810 intel mach64 mga neomagic nv r128 radeon savage sis tdfx trident vesa vga via vmware voodoo"
Unset: CPPFLAGS, CTARGET, EMERGE_DEFAULT_OPTS, FFLAGS, INSTALL_MASK, LC_ALL, LINGUAS, PORTAGE_COMPRESS, PORTAGE_COMPRESS_FLAGS, PORTAGE_RSYNC_EXTRA_OPTS |
|
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
Hu Administrator
![Administrator Administrator](/images/ranks/rank-admin.gif)
Joined: 06 Mar 2007 Posts: 23100
|
Posted: Sat Jun 06, 2009 1:56 am Post subject: |
|
|
Since screen is often used to multiplex shells over a single login session, it is often desirable to have it show only one login total, rather than one per screen session. You may be able to make individual sessions show up if you set deflogin on in the screen configuration file. According to the documentation, it is already on by default, so this user may have disabled it in his personal .screenrc. If so, you will need to undo that change and count on good behavior to leave it that way. Individual screen sessions can be moved in or out of the "logged in" state at any time by the user on that screen session. |
|
Back to top |
|
![](templates/gentoo/images/spacer.gif) |
|
|
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
|
|