Red Hat Bugzilla – Bug 673533
'last' command in sysVinit truncates usernames
Last modified: 2016-04-05 07:09:12 EDT
+++ This bug was initially created as a clone of Bug #550333 +++
Description of problem:
The GNU acct package includes a version of the last command that is still actively developed (last ChangeLog entry is Aug 2009). In that package, the 'last' command includes a non-documented option -w or --wide that changes the length of the user name column from 8 to 8+ characters.
The SysVInit package that has been included in Red Hat Enterprise Linux, Fedora, and all the Red Hat based distros (like CentOS) has not been changed apparently since 2004. The version of 'last' in the sysvinit version does not include the wide option.
This bug affects modern Linux systems and system administration as using last to view current and previous logins will display a truncated username if the username is over 8 characters long. The Red Hat version of last does NOT substitute UID in place of Username in cases where the Username is > 8 characters.
Given two usernames, michelleharris and michelleharrison, if both have recently logged in, their entires in wtmp will show (using strings on the wtmp file) their full user names. HOWEVER, if you try to view recent logins via the 'last' command, you will see the usernames truncated and impossible to differentiate:
The expected outcome would be either an inclusion of the -w / --wide option from GNU's acct 'last' command, or substituting the UID for Username in 'last' output when the username is longer than 8 characters.
Version-Release number of selected component (if applicable):
Steps to Reproduce:
1. Create two user accounts where the first 8 characters are similar:
2. log each user in via separate means (tty, local, whatever)
3. run strings against /var/log/wtmp and note that the entires for each user's login show the full usernames.
4. run 'last' and note that the user names are truncated to 8 characters and both display the username michelle though they are, in reality, two different user accounts.
Usernames are truncated to 8 characters
Either a -w / --wide option to display full usernames in the output of 'last' or logic that subs UID for username when username is > 8 characters
--- Additional comment from firstname.lastname@example.org on 2010-01-12 10:42:54 EST ---
Created attachment 383263 [details]
add lst -w option for wide output
This patch adds -w options to last command. With this option are not cut down user and domain names in output.
http://koji.fedoraproject.org/koji/taskinfo?taskID=1916831 scratch build with applied patch, please test whether it's suitable for you.
--- Additional comment from email@example.com on 2010-03-22 05:35:16 EDT ---
sysvinit-2.87-3.dsf.fc12 has been submitted as an update for Fedora 12.
--- Additional comment from firstname.lastname@example.org on 2010-03-22 05:48:00 EDT ---
sysvinit-2.87-3.dsf.fc13 has been submitted as an update for Fedora 13.
--- Additional comment from email@example.com on 2010-03-23 19:30:04 EDT ---
sysvinit-2.87-3.dsf.fc12 has been pushed to the Fedora 12 testing repository. If problems still persist, please make note of it in this bug report.
If you want to test the update, you can install it with
su -c 'yum --enablerepo=updates-testing update sysvinit'. You can provide feedback for this update here: http://admin.fedoraproject.org/updates/sysvinit-2.87-3.dsf.fc12
--- Additional comment from firstname.lastname@example.org on 2010-04-08 23:51:24 EDT ---
sysvinit-2.87-3.dsf.fc13 has been pushed to the Fedora 13 stable repository. If problems still persist, please make note of it in this bug report.
--- Additional comment from email@example.com on 2010-04-10 06:14:39 EDT ---
sysvinit-2.87-3.dsf.fc12 has been pushed to the Fedora 12 stable repository. If problems still persist, please make note of it in this bug report.
Created attachment 475822 [details]
patch to add wide capability to usernames against current rhel5 sources
Created attachment 489025 [details]
add wide capability to usernames and domain names
added also wide domainname output to patch from #c1 according to man page change in patch
This request was evaluated by Red Hat Product Management for inclusion in a Red
Hat Enterprise Linux maintenance release. Product Management has requested
further review of this request by Red Hat Engineering, for potential
inclusion in a Red Hat Enterprise Linux Update release for currently deployed
products. This request is not yet committed for inclusion in an Update
An advisory has been issued which should help the problem
described in this bug report. This report is therefore being
closed with a resolution of ERRATA. For more information
on therefore solution and/or where to find the updated files,
please follow the link below. You may reopen this bug report
if the solution does not work for you.