.\" -*- coding: UTF-8 -*- .\" Copyright (c) 1993 Michael Haardt (michael@cantor.informatik.rwth-aachen.de), .\" Fri Apr 2 11:32:09 MET DST 1993 .\" .\" SPDX-License-Identifier: GPL-2.0-or-later .\" .\" Modified 1993-07-25 by Rik Faith (faith@cs.unc.edu) .\" Modified 1995-02-26 by Michael Haardt .\" Modified 1996-07-20 by Michael Haardt .\" Modified 1997-07-02 by Nicolás Lichtmaier .\" Modified 2004-10-31 by aeb, following Gwenole Beauchesne .\"******************************************************************* .\" .\" This file was generated with po4a. Translate the source file. .\" .\"******************************************************************* .TH utmp 5 "3 maggio 2023" "Linux man\-pages 6.05.01" .SH NOME utmp, wtmp \- registri dei login .SH SINTASSI .nf \fB#include \fP .fi .SH DESCRIZIONE Il file \fIutmp\fP permette di scoprire informazioni su chi sta usando attualmente il sistema. Ci possono essere più utenti che stanno usando il sistema di quelli riportati, poiché non tutti i programmi usano registrazioni utmp. .PP \fBAttenzione:\fP \fIutmp\fP non deve essere scrivibile dalla classe di utenti "other", poiché molti programmi di sistema dipendono (stupidamente) dalla sua integrità. Si rischia di avere file di log contraffatti e file di sistema modificati se si lascia \fIutmp\fP scrivibile da utenti che non siano il proprietario o il gruppo proprietario del file. .PP Il file è una sequenza di strutture \fIutmp\fP, dichiarate nel modo seguente in \fI\fP (si noti che questa è solo una delle numerose definizioni in giro; i dettagli dipendono dalla versione di libc): .PP .in +4n .EX /* Values for ut_type field, below */ \& #define EMPTY 0 /* Record does not contain valid info (formerly known as UT_UNKNOWN on Linux) */ #define RUN_LVL 1 /* Change in system run\-level (see \fBinit\fP(1)) */ #define BOOT_TIME 2 /* Time of system boot (in \fIut_tv\fP) */ #define NEW_TIME 3 /* Time after system clock change (in \fIut_tv\fP) */ #define OLD_TIME 4 /* Time before system clock change (in \fIut_tv\fP) */ #define INIT_PROCESS 5 /* Process spawned by \fBinit\fP(1) */ #define LOGIN_PROCESS 6 /* Session leader process for user login */ #define USER_PROCESS 7 /* Normal process */ #define DEAD_PROCESS 8 /* Terminated process */ #define ACCOUNTING 9 /* Not implemented */ \& #define UT_LINESIZE 32 #define UT_NAMESIZE 32 #define UT_HOSTSIZE 256 \& struct exit_status { /* Type for ut_exit, below */ short e_termination; /* Process termination status */ short e_exit; /* Process exit status */ }; \& struct utmp { short ut_type; /* Type of record */ pid_t ut_pid; /* PID of login process */ char ut_line[UT_LINESIZE]; /* Device name of tty \- "/dev/" */ char ut_id[4]; /* Terminal name suffix, or inittab(5) ID */ char ut_user[UT_NAMESIZE]; /* Username */ char ut_host[UT_HOSTSIZE]; /* Hostname for remote login, or kernel version for run\-level messages */ struct exit_status ut_exit; /* Exit status of a process marked as DEAD_PROCESS; not used by Linux init(1) */ /* The ut_session and ut_tv fields must be the same size when compiled 32\- and 64\-bit. This allows data files and shared memory to be shared between 32\- and 64\-bit applications. */ #if __WORDSIZE == 64 && defined __WORDSIZE_COMPAT32 int32_t ut_session; /* Session ID (\fBgetsid\fP(2)), used for windowing */ struct { int32_t tv_sec; /* Seconds */ int32_t tv_usec; /* Microseconds */ } ut_tv; /* Time entry was made */ #else long ut_session; /* Session ID */ struct timeval ut_tv; /* Time entry was made */ #endif \& int32_t ut_addr_v6[4]; /* Internet address of remote host; IPv4 address uses just ut_addr_v6[0] */ char __unused[20]; /* Reserved for future use */ }; \& /* Backward compatibility hacks */ #define ut_name ut_user #ifndef _NO_UT_TIME #define ut_time ut_tv.tv_sec #endif #define ut_xtime ut_tv.tv_sec #define ut_addr ut_addr_v6[0] .EE .in .PP This structure gives the name of the special file associated with the user's terminal, the user's login name, and the time of login in the form of \fBtime\fP(2). String fields are terminated by a null byte (\[aq]\e0\[aq]) if they are shorter than the size of the field. .PP Le prime voci del file sono il risultato di \fBinit\fP(1) quando elabora \fBinittab\fP(5). Prima che una voce sia eseguita, però, \fBinit\fP(1) pulisce il file utmp assegnando il valore di \fBDEAD_PROCESS\fP a \fIut_type\fP, pulendo \fIut_user\fP, \fIut_host\fP e \fIut_time\fP con byte nulli per ogni registrazione il cui \fIut_type\fP non sia \fIDEAD_PROCESS\fP o \fIRUN_LVL\fP, e quelle per cui non esistono processi con PID \fIut_pid\fP. Se non si trovano registrazioni vuote con la \fIut_id\fP necessaria, \fBinit\fP(1) ne crea una nuova. Poi assegna \fIut_id\fP dal file inittab, assegna i valori attuali a \fIut_pid\fP e \fIut_time\fP e assegna \fBINIT_PROCESS\fP a \fIut_type\fP. .PP \fBmingetty\fP(8) (o \fBagetty\fP(8)) localizza le voci tramite il PID, cambia \fIut_type\fP perché contenga \fBLOGIN_PROCESS\fP, aggiorna \fIut_time\fP, assegna \fIut_line\fP e aspetta che venga stabilita una connessione. \fBlogin\fP(1), dopo aver autenticato un utente, cambia \fIut_type\fP perché valga \fBUSER_PROCESS\fP, aggiorna \fIut_time\fP e imposta \fIut_host\fP e \fIut_addr\fP. In base al comportamento di \fBmingetty\fP(8) (o \fBagetty\fP(8)) e \fBlogin\fP(1), i record possono essere indirizzati da \fIut_line\fP invece del metodo preferibile, \fIut_pid\fP. .PP Quando \fBinit\fP(1) scopre che un processo è terminato, ricerca la sua voce utmp tramite \fIut_pid\fP, assegna il valore \fBDEAD_PROCESS\fP a \fIut_type\fP e pulisce \fIut_user\fP, \fIut_host\fP e \fIut_time\fP, assegnandogli dei byte nulli. .PP \fBxterm\fP(1) and other terminal emulators directly create a \fBUSER_PROCESS\fP record and generate the \fIut_id\fP by using the string that suffix part of the terminal name (the characters following \fI/dev/\fP[pt]\fIty\fP). If they find a \fBDEAD_PROCESS\fP for this ID, they recycle it, otherwise they create a new entry. If they can, they will mark it as \fBDEAD_PROCESS\fP on exiting and it is advised that they null \fIut_line\fP, \fIut_time\fP, \fIut_user\fP, and \fIut_host\fP as well. .PP \fBtelnetd\fP(8) imposta una voce \fBLOGIN_PROCESS\fP e lascia il resto a \fBlogin\fP(1) come al solito. Dopo che la sessione telnet termina \fBtelnetd\fP(8) pulisce utmp nel modo descritto. .PP The \fIwtmp\fP file records all logins and logouts. Its format is exactly like \fIutmp\fP except that a null username indicates a logout on the associated terminal. Furthermore, the terminal name \fB\[ti]\fP with username \fBshutdown\fP or \fBreboot\fP indicates a system shutdown or reboot and the pair of terminal names \fB|\fP/\fB}\fP logs the old/new system time when \fBdate\fP(1) changes it. \fIwtmp\fP is maintained by \fBlogin\fP(1), \fBinit\fP(1), and some versions of \fBgetty\fP(8) (e.g., \fBmingetty\fP(8) or \fBagetty\fP(8)). None of these programs creates the file, so if it is removed, record\-keeping is turned off. .SH FILE \fI/var/run/utmp\fP .br \fI/var/log/wtmp\fP .SH VERSIONI POSIX.1 does not specify a \fIutmp\fP structure, but rather one named \fIutmpx\fP (as part of the XSI extension), with specifications for the fields \fIut_type\fP, \fIut_pid\fP, \fIut_line\fP, \fIut_id\fP, \fIut_user\fP, and \fIut_tv\fP. POSIX.1 does not specify the lengths of the \fIut_line\fP and \fIut_user\fP fields. .PP Linux definisce la struttura \fIutmpx\fP uguale a quella di \fIutmp\fP. .SH STANDARDS Linux. .SH STORIA Le voci Linux utmp non sono conformi nè a v7/BSD nè a SYSV; esse sono un mix delle due. .PP v7/BSD ha meno campi; più importante, esso non ha \fIut_type\fP, e ciò fa sì che programmi nativi v7/BSD visualizzino (per esempio) voci morte o di login. Inoltre, non c'è alcun file di configurazione che alloca spazi alle sessioni. BSD fa questo perché non ha campi \fIut_id\fP. .PP In Linux (come in System V), il campo \fIut_id\fP di un record non cambierà mai una volta che è stato impostato, e ciò riserva questo spazio senza bisogno di un file di configurazione. Cancellare \fIut_id\fP può dar luogo a delle race condition che portano a voci utmp corrotte e a potenziali buchi di sicurezza. Cancellare i campi menzionati sopra riempiendoli con byte nulli non è richiesto dalla semantica System V, ma permette di eseguire molti programmi che assumono la semantica BSD e che non modificano utmp. Linux usa le convenzioni BSD per i contenuti di linea, come documentato in precedenza. .PP .\" mtk: What is the referrent of "them" in the following sentence? .\" System V only uses the type field to mark them and logs .\" informative messages such as \fB"new time"\fP in the line field. System V non ha campi \fIut_host\fP o \fIut_addr_v6\fP. .SH NOTE A differenza di vari altri sistemi, in cui la registrazione in utmp può essere disabilitata cancellando il file, utmp deve sempre esistere in Linux. Se si vuole disabilitare \fBwho\fP(1) basta togliere il permesso di lettura globale al file utmp. .PP Il formato del file dipende dalla macchina, perciò si raccomanda di elaborarlo solo su macchine con la stessa architettura di quella su cui il file è stato creato. .PP Notare che su piattaforme \fIbiarch\fP, cioé sistemi che possono far girare sia applicazioni 32\-bit che 64\-bit (x86\-64, ppc64, s390x, etc.), \fIut_tv\fP è della stessa dimensione in modalità 32\-bit e in modalità 64\-bit. Lo stesso vale per \fIut_session\fP e \fIut_time\fP se sono presenti. Ciò permette a file dati e memoria condivisa di essere condivisi tra applicazioni 32\-bit e applicazioni 64\-bit. Ciò si ottiene cambiando il tipo di \fIut_session\fP a \fIint32_t\fP, e il tipo di \fIut_tv\fP ad una struttura con due campi \fIint32_t\fP, \fItv_sec\fP e \fItv_usec\fP. Poiché \fIut_tv\fP potrebbe non essere lo stesso di \fIstruct timeval\fP, invece della chiamata: .PP .in +4n .EX gettimeofday((struct timeval *) &ut.ut_tv, NULL); .EE .in .PP si raccomanda il seguente metodo per impostare il campo: .PP .in +4n .EX struct utmp ut; struct timeval tv; \& gettimeofday(&tv, NULL); ut.ut_tv.tv_sec = tv.tv_sec; ut.ut_tv.tv_usec = tv.tv_usec; .EE .in .\" .PP .\" Note that the \fIutmp\fP struct from libc5 has changed in libc6. .\" Because of this, .\" binaries using the old libc5 struct will corrupt .\" .IR /var/run/utmp " and/or " /var/log/wtmp . .\" .SH BUGS .\" This man page is based on the libc5 one, things may work differently now. .SH "VEDERE ANCHE" \fBac\fP(1), \fBdate\fP(1), \fBinit\fP(1), \fBlast\fP(1), \fBlogin\fP(1), \fBlogname\fP(1), \fBlslogins\fP(1), \fBusers\fP(1), \fButmpdump\fP(1), \fBwho\fP(1), \fBgetutent\fP(3), \fBgetutmp\fP(3), \fBlogin\fP(3), \fBlogout\fP(3), \fBlogwtmp\fP(3), \fBupdwtmp\fP(3) .PP .SH TRADUZIONE La traduzione italiana di questa pagina di manuale è stata creata da Giovanni Bortolozzo , Alessandro Rubini , Ottavio G. Rizzo , Giulio Daprelà , Elisabetta Galli e Marco Curreli . .PP Questa traduzione è documentazione libera; leggere la .UR https://www.gnu.org/licenses/gpl-3.0.html GNU General Public License Versione 3 .UE o successiva per le condizioni di copyright. Non ci assumiamo alcuna responsabilità. .PP Per segnalare errori nella traduzione di questa pagina di manuale inviare un messaggio a .MT pluto-ildp@lists.pluto.it .ME .