1838005 Members
5499 Online
110124 Solutions
New Discussion

Re: Last Command

 
George_14
Occasional Advisor

Last Command

Even After rebooting the system, the last command shows that users are still logged in. How can I solve it? Thanks.
4 REPLIES 4
RikTytgat
Honored Contributor

Re: Last Command

Hi,

If you don't care about the contents of the wtmp file, truncate it (> /var/adm/wtmp).

If you want to keep the logging, try this:

# cat /var/adm/wtmp | /usr/sbin/acct/fwtmp > filename
# vi filename
...
remove the entries you do not want
...
# cat filename | fwtmp -ic > /var/adm/wtmp.new

Now, check your newly created wtmp file:

# last -f /var/adm/wtmp.new
...

If the results are satisfactory, move the new file to /var/adm/wtmp

Good luck,
Rik
Rainer von Bongartz
Honored Contributor

Re: Last Command

cat /dev/null > /var/adm/wtmp zeroes the input file for the last command
He's a real UNIX Man, sitting in his UNIX LAN making all his UNIX plans for nobody ...
Ravi_8
Honored Contributor

Re: Last Command

Hi,
the last command list the users who were logged in and exit. to get the current logged in users use 'w' commad. if you don't want to see any last users make it null by #cat /dev/null > /var/adm/wtmp
never give up
George_14
Occasional Advisor

Re: Last Command

I do care about the content. When I execute last command in solaris it shows all the logged users and the users who have acces the system, it doesn't shows the logged out users as still logged in.But in HP ,even though the user(s) is(are) logged out, when I execute last command it shows me the user still logged.