PDA

View Full Version : w does show no one login


59ideas
04-11-2006, 11:15 AM
Any idea how I fix this?

I am sign in but w always show this.

18:13:06 up 2 days, 14:36, 0 users, load average: 0.00, 0.00, 0.00
USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT


last also does not show any record. :confused:

Mr.Loge
04-11-2006, 11:56 AM
What say "users" command ?

Mr.Loge
04-11-2006, 12:13 PM
Hmm.. Im search a little, possible reason for this are permissions. Try this - http://linux.derkeiler.com/Mailing-Lists/Fedora/2004-09/2757.html

59ideas
04-12-2006, 02:06 AM
users also shows nothing.

Thanks! Will try and report back result.

59ideas
04-12-2006, 02:24 AM
Exactly the same problem as the link..

Try this sequence of things:

cat /selinux/enforce
alias w
alias ls
which w
ls -l `which w`
id
strace -o /tmp/trace-w /usr/bin/w

There is no /selinux/enforce
I'm using CentOS

The rest looks pretty standard.

The strace gives a long list which I could not understand. The key might be the code at the end ?

open("/etc/localtime", O_RDONLY) = 3
open("/proc/uptime", O_RDONLY) = 3
open("/var/run/utmp", O_RDWR) = 4
open("/proc/loadavg", O_RDONLY) = 4
open("/var/run/utmp", O_RDWR) = 5

david
04-12-2006, 02:59 AM
are you trying this as root ? Not saying only root can run it, but that'd rule out some permission problems maybe.

Do you have /var/run/utmp ?? Look at "man who" and try the different switches.

Mr.Loge
04-12-2006, 03:30 AM
david, he maybe not from root, but if he will not have enough permissions to open /var/run/utmp in O_RDWR mode(read/write) it cause EACCESS error. As we see /var/run/utmp is opened and no error occur (open("/var/run/utmp", O_RDWR) = 4).

59ideas, what "last" show ?

59ideas
04-12-2006, 04:00 AM
Thanks!
I running as root.

Yes, /var/run/utmp is there.

last is empty as well.

reboot system boot 2.6.9 Sun Apr 9 03:37 (3+07:19)

wtmp begins Sun Apr 9 03:33:28 2006

Mr.Loge
04-12-2006, 05:59 AM
59ideas, "ps aux --sort=-suser | grep pts" show something ?

Edit:

Very likely your VPS is on OpenVZ platform, so here we go:

forum post - link (http://forum.openvz.org/index.php?t=msg&goto=2373%EF%BF%BDmsg_2373#msg_2373)
bugzilla - link (http://bugzilla.openvz.org/show_bug.cgi?id=124)

corkyb
04-12-2006, 11:52 PM
I could make a political joke.."w" shows no one logged on!

Seriously try cat /dev/null > utmp, then log off and back on. It should
recreate utmp and hopefully be correct.

59ideas
04-13-2006, 12:10 AM
here you go

[root@vps ~]# ps aux --sort=-suser | grep pts
root 32110 0.1 0.0 2280 1088 pts/0 S 06:55 0:00 su -
root 32320 1.6 0.0 2148 1272 pts/0 S 06:55 0:00 -bash
root 32509 0.0 0.0 2304 752 pts/0 R+ 06:55 0:00 ps aux --sort=-suser
root 32510 0.0 0.0 1576 472 pts/0 S+ 06:55 0:00 grep pts
myu 28488 0.0 0.0 6880 2264 ? S 06:54 0:00 sshd: myu@pts/0
myu 28511 0.1 0.0 2152 1244 pts/0 Ss 06:55 0:00 -bash
myu 30210 0.0 0.0 6880 2260 ? S 06:55 0:00 sshd: myu@pts/1
myu 30303 0.1 0.0 2152 1240 pts/1 Ss+ 06:55 0:00 -bash

Thanks for the tips!! :)

59ideas
04-13-2006, 06:18 AM
Seriously try cat /dev/null > utmp, then log off and back on. It should
recreate utmp and hopefully be correct.

No that doesn't work.

Very likely your VPS is on OpenVZ platform, so here we go:

forum post - link (http://forum.openvz.org/index.php?t=msg&goto=2373%EF%BF%BDmsg_2373#msg_2373)
bugzilla - link (http://bugzilla.openvz.org/show_bug.cgi?id=124)

I think you are right. It's beyond my ability to fix, guess I will have to wait for some fix? :(

Rick
04-13-2006, 12:50 PM
yeah we have a fix coming for this soon. I will uppdate you when its patched.

59ideas
05-18-2006, 04:10 AM
yeah we have a fix coming for this soon. I will uppdate you when its patched.


Has this been patched yet?
I still do not see anyone login with w :(

Rick
05-25-2006, 10:46 AM
I found a workaround for this....

1)
edit /etc/ssh/sshd_config

2)
add this at the bottom:

UsePAM no
UseLogin yes

3)
/etc/init.d/sshd restart

4)
log out, log back in

5)
[root@dns1 ~]# w
17:44:47 up 15:19, 1 user, load average: 0.45, 0.20, 0.11
USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT
root pts/2 sulfur.rapidvps. 17:44 0.00s 0.05s 0.00s w



background:
sshd in Redhat AS4-u3 (CentOS 4.3) is trying to connect to kauditd socket using NETLINK.
This operation fails and thus sshd is not adding the record to utmp.
It is a bug in Redhat's patch to sshd.

59ideas
08-01-2006, 01:39 PM
What's the implication of UsePAM No vs Yes?

Rick
08-01-2006, 01:56 PM
long winded answer. bottom line you need to understand what pam is. if you don't the answer wont mean anything. check out a document on what pam is first, then it will be clear.