xref: /openbsd-src/lib/libutil/login.3 (revision 86f9d4cdda0e0267dccd8755ac0035525579c4a7)
1*86f9d4cdStedu.\"	$OpenBSD: login.3,v 1.6 2013/06/05 03:40:26 tedu Exp $
29046b325Scsapuntz.\"
34b826ba8Sderaadt.\" Copyright (c) 1995
44b826ba8Sderaadt.\"	The Regents of the University of California.  All rights reserved.
54b826ba8Sderaadt.\"
64b826ba8Sderaadt.\" This code is derived from software developed by the Computer Systems
74b826ba8Sderaadt.\" Engineering group at Lawrence Berkeley Laboratory under DARPA contract
84b826ba8Sderaadt.\" BG 91-66 and contributed to Berkeley.
94b826ba8Sderaadt.\"
104b826ba8Sderaadt.\" Redistribution and use in source and binary forms, with or without
114b826ba8Sderaadt.\" modification, are permitted provided that the following conditions
124b826ba8Sderaadt.\" are met:
134b826ba8Sderaadt.\" 1. Redistributions of source code must retain the above copyright
144b826ba8Sderaadt.\"    notice, this list of conditions and the following disclaimer.
154b826ba8Sderaadt.\" 2. Redistributions in binary form must reproduce the above copyright
164b826ba8Sderaadt.\"    notice, this list of conditions and the following disclaimer in the
174b826ba8Sderaadt.\"    documentation and/or other materials provided with the distribution.
186580fee3Smillert.\" 3. Neither the name of the University nor the names of its contributors
194b826ba8Sderaadt.\"    may be used to endorse or promote products derived from this software
204b826ba8Sderaadt.\"    without specific prior written permission.
214b826ba8Sderaadt.\"
224b826ba8Sderaadt.\" THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
234b826ba8Sderaadt.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
244b826ba8Sderaadt.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
254b826ba8Sderaadt.\" ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
264b826ba8Sderaadt.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
274b826ba8Sderaadt.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
284b826ba8Sderaadt.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
294b826ba8Sderaadt.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
304b826ba8Sderaadt.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
314b826ba8Sderaadt.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
324b826ba8Sderaadt.\" SUCH DAMAGE.
334b826ba8Sderaadt.\"
34*86f9d4cdStedu.Dd $Mdocdate: June 5 2013 $
354b826ba8Sderaadt.Dt LOGIN 3
364b826ba8Sderaadt.Os
374b826ba8Sderaadt.Sh NAME
384b826ba8Sderaadt.Nm login ,
394b826ba8Sderaadt.Nm logout ,
404b826ba8Sderaadt.Nm logwtmp
414b826ba8Sderaadt.Nd login utility functions
424b826ba8Sderaadt.Sh SYNOPSIS
43*86f9d4cdStedu.In utmp.h
44*86f9d4cdStedu.In util.h
454b826ba8Sderaadt.Ft void
464b826ba8Sderaadt.Fn login "struct utmp *ut"
474b826ba8Sderaadt.Ft int
484b826ba8Sderaadt.Fn logout "const char *line"
494b826ba8Sderaadt.Ft void
504b826ba8Sderaadt.Fn logwtmp "const char *line" "const char *name" "const char *host"
514b826ba8Sderaadt.Sh DESCRIPTION
524b826ba8SderaadtThe
534b826ba8Sderaadt.Fn login ,
544b826ba8Sderaadt.Fn logout ,
554b826ba8Sderaadtand
564b826ba8Sderaadt.Fn logwtmp
574b826ba8Sderaadtfunctions operate on the database of current users in
584b826ba8Sderaadt.Pa /var/run/utmp
594b826ba8Sderaadtand on the logfile
604b826ba8Sderaadt.Pa /var/log/wtmp
614b826ba8Sderaadtof logins and logouts.
624b826ba8Sderaadt.Pp
634b826ba8SderaadtThe
644b826ba8Sderaadt.Fn login
654b826ba8Sderaadtfunction updates the
664b826ba8Sderaadt.Pa /var/run/utmp
674b826ba8Sderaadtand
684b826ba8Sderaadt.Pa /var/log/wtmp
694b826ba8Sderaadtfiles with user information contained in
704b826ba8Sderaadt.Fa ut .
714b826ba8Sderaadt.Pp
724b826ba8SderaadtThe
734b826ba8Sderaadt.Fn logout
744b826ba8Sderaadtfunction removes the entry from
754b826ba8Sderaadt.Pa /var/run/utmp
764b826ba8Sderaadtcorresponding to the device
774b826ba8Sderaadt.Fa line .
784b826ba8Sderaadt.Pp
794b826ba8SderaadtThe
804b826ba8Sderaadt.Fn logwtmp
814b826ba8Sderaadtfunction adds an entry to
824b826ba8Sderaadt.Pa /var/log/wtmp .
834b826ba8SderaadtSince
844b826ba8Sderaadt.Fn login
854b826ba8Sderaadtwill add the appropriate entry for
864b826ba8Sderaadt.Pa /var/log/wtmp
874b826ba8Sderaadtduring a login,
884b826ba8Sderaadt.Fn logwtmp
894b826ba8Sderaadtis usually used for logouts.
904b826ba8Sderaadt.Sh RETURN VALUES
914b826ba8Sderaadt.Fn logout
924b826ba8Sderaadtreturns non-zero if it was able to find and delete an entry for
934b826ba8Sderaadt.Fa line ,
944b826ba8Sderaadtand zero if there is no entry for
954b826ba8Sderaadt.Fa line
964b826ba8Sderaadtin
974b826ba8Sderaadt.Pa /var/run/utmp .
984b826ba8Sderaadt.Sh FILES
994b826ba8Sderaadt.Bl -tag -width /var/run/wtmp -compact
1004b826ba8Sderaadt.It Pa /dev/\(**
1014b826ba8Sderaadt.It Pa /etc/ttys
1024b826ba8Sderaadt.It Pa /var/run/utmp
1034b826ba8Sderaadt.It Pa /var/log/wtmp
1044b826ba8Sderaadt.El
1054b826ba8Sderaadt.Sh SEE ALSO
1064b826ba8Sderaadt.Xr utmp 5
107