summaryrefslogtreecommitdiffstats
path: root/login-utils/lslogins.1
blob: f003ef264860925693cbd1d95921e06965389941 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
.\" Copyright 2014 Ondrej Oprala (ondrej.oprala@gmail.com)
.\" May be distributed under the GNU General Public License
.TH LSLOGINS "1" "April 2014" "util-linux" "User Commands"
.SH NAME
lslogins \- display information about known users in the system
.SH SYNOPSIS
.B lslogins
[options]
.RB [ \-s | \-u [ =\fIUID ]]
.RB [ \-g " \fIgroups\fR]"
.RB [ \-l " \fIlogins\fR]"
.RB [\fIusername\fR]
.SH DESCRIPTION
.PP
Examine the wtmp and btmp logs, /etc/shadow (if necessary) and /etc/passwd
and output the desired data.

The optional argument \fIusername\fR forces
.BR lslogins
to print all available details about the specified user only. In this case the
output format is different than in case of \fB\-l\fR or \fB\-g\fR and unknown
is \fIusername\fR reported as an error.

.PP
The default action is to list info about all the users in the system.
.SH OPTIONS
Mandatory arguments to long options are mandatory for short options too.
.TP
\fB\-a\fR, \fB\-\-acc\-expiration\fR
Display data about the date of last password change and the account expiration
date (see \fBshadow\fR(5) for more info).  (Requires root privileges.)
.TP
\fB\-\-btmp\-file \fIpath\fP
Alternate path for btmp.
.TP
\fB\-c\fR, \fB\-\-colon\-separate\fR
Separate info about each user with a colon instead of a newline.
.TP
\fB\-e\fR, \fB\-\-export\fR
Output data in the format of NAME=VALUE.
.TP
\fB\-f\fR, \fB\-\-failed\fR
Display data about the users' last failed login attempts.
.TP
\fB\-G\fR, \fB\-\-supp\-groups\fR
Show information about supplementary groups.
.TP
\fB\-g\fR, \fB\-\-groups\fR=\fIgroups\fR
Only show data of users belonging to \fIgroups\fR.  More than one group
may be specified; the list has to be comma-separated.  The unknown group
names are ignored.

Note that relation between user and group may be invisible for primary group if
the user is not explicitly specify as group member (e.g. in /etc/group). If the
command lslogins scans for groups than it uses groups database only, and user
database with primary GID is not used at all.
.TP
\fB\-h\fR, \fB\-\-help\fR
Display help information and exit.
.TP
\fB\-L\fR, \fB\-\-last\fR
Display data containing information about the users' last login sessions.
.TP
\fB\-l\fR, \fB\-\-logins\fR=\fIlogins\fR
Only show data of users with a login specified in \fIlogins\fR (user names or user
IDS).  More than one login may be specified; the list has to be comma-separated.
The unknown login names are ignored.
.TP
\fB\-n\fR, \fB\-\-newline\fR
Display each piece of information on a separate line.
.TP
\fB\-\-noheadings\fR
Do not print a header line.
.TP
\fB\-\-notruncate\fR
Don't truncate output.
.TP
\fB\-o\fR, \fB\-\-output \fIlist\fP
Specify which output columns to print. 
The default list of columns may be extended if \fIlist\fP is
specified in the format \fI+list\fP.
.TP
.B \-\-output\-all
Output all available columns.
.B \-\-help
to get a list of all supported columns.
.TP
\fB\-p\fR, \fB\-\-pwd\fR
Display information related to login by password (see also \fB\-afL).
.TP
\fB\-r\fR, \fB\-\-raw\fR
Raw output (no columnation).
.TP
\fB\-s\fR, \fB\-\-system\-accs\fR
Show system accounts.  These are by default all accounts with a UID between 101 and 999
(inclusive), with the exception of either nobody or nfsnobody (UID 65534).
This hardcoded default may be overwritten by parameters SYS_UID_MIN and SYS_UID_MAX in
the file /etc/login.defs.
.TP
\fB\-\-time\-format\fR \fItype\fP
Display dates in short, full or iso format.  The default is short, this time
format is designed to be space efficient and human readable.
.TP
\fB\-u\fR, \fB\-\-user\-accs\fR
Show user accounts.  These are by default all accounts with UID above 1000
(inclusive), with the exception of either nobody or nfsnobody (UID 65534).
This hardcoded default maybe overwritten by parameters UID_MIN and UID_MAX in
the file /etc/login.defs.
.TP
\fB\-V\fR, \fB\-\-version\fR
Display version information and exit.
.TP
\fB\-\-wtmp\-file \fIpath\fP
Alternate path for wtmp.
.TP
\fB\-Z\fR, \fB\-\-context\fR
Display the users' security context.
.TP
\fB\-z\fR, \fB\-\-print0\fR
Delimit user entries with a nul character, instead of a newline.

.SH NOTES
The default UID thresholds are read from /etc/login.defs.

.SH EXIT STATUS
.TP
0
if OK,
.TP
1
if incorrect arguments specified,
.TP
2
if a serious error occurs (e.g. a corrupt log).
.SH SEE ALSO
\fBgroup\fP(5), \fBpasswd\fP(5), \fBshadow\fP(5), \fButmp\fP(5)
.SH HISTORY
The \fBlslogins\fP utility is inspired by the \fBlogins\fP utility, which first appeared in FreeBSD 4.10.
.SH AUTHORS
.MT ooprala@redhat.com
Ondrej Oprala
.ME
.br
.MT kzak@redhat.com
Karel Zak
.ME

.SH AVAILABILITY
The lslogins command is part of the util-linux package and is available from
.UR https://\:www.kernel.org\:/pub\:/linux\:/utils\:/util-linux/
Linux Kernel Archive
.UE .