(serveur) Suppression last-login à la connexion

Bonjour à tous,

Je tente de supprimer la ligne “Last login” qui est affichée lors d’une connexion réussie à mon serveur

root@xxx's password: Last login: Thu Aug 2 02:02:24 2012 from xxx
La ligne est affichée juste avant mon motd malgré les différentes tentatives pour m’en débarrasser.

(actuellement mon motd est un script appelé par zsh au chargement)

Merci d’avance pour votre aide.

C’est une ligne utile point de vue sécurité …
Mais je ne sais pas comment l’enlever … d’ailleur pourquoi l’enlever ?

Bonjour et merci pour ta réponse :slightly_smiling:

Je ne conteste pas l’utilité de cette info. Je souhaiterais avoir le contrôle sur son comportement.

En l’état, elle est affichée avant mon motd et c’est juste crade. Il ne s’agit pas de la supprimer purement et simplement mais de la déplacer dans mon motd (ce qui n’est pas complexe du tout en jouant avec “last” ou “lastlog”).

Déjà il faut expliquer “motd” qui est une abbrevation de “Message Of The Day”.

Sinon un rapide recherche google te donne plusieurs réponse (“linux last login message remove”).
Celle ci me semble la plus clair
heatware.net/linux-unix/linux-ho … e-message/

/etc/login.defs - Configuration control definitions for the login package.

# Enable logging and display of /var/log/faillog login failure info.
# This option conflicts with the pam_tally PAM module.
#
FAILLOG_ENAB		yes

#
# Enable display of unknown usernames when login failures are recorded.
#
# WARNING: Unknown usernames may become world readable. 
# See #290803 and #298773 for details about how this could become a security
# concern
LOG_UNKFAIL_ENAB	no

#
# Enable logging of successful logins
#
LOG_OK_LOGINS		no

...
#
# If defined, login failures will be logged here in a utmp format
# last, when invoked as lastb, will read /var/log/btmp, so...
#
FTMP_FILE	/var/log/btmp
...

#
# If defined, file which inhibits all the usual chatter during the login
# sequence.  If a full pathname, then hushed mode will be enabled if the
# user's name or shell are found in the file.  If not a full pathname, then
# hushed mode will be enabled if the file exists in the user's home directory.
#
HUSHLOGIN_FILE	.hushlogin
#HUSHLOGIN_FILE	/etc/hushlogins

$ man last

DESCRIPTION
       Last  searches back through the file /var/log/wtmp (or the file desig‐
       nated by the -f flag) and displays a list of all users logged in  (and
       out)  since  that  file  was created.
       
       
       ...
       
       
       Lastb  is  the  same as last, except that by default it shows a log of
       the file /var/log/btmp, which contains all the bad login attempts.
       
       ...
       
       NOTES
       The  files  wtmp  and  btmp  might  not be found. The system only logs
       information in these files if they are present. This is a  local  con‐
       figuration  issue.  If you want the files to be used, they can be cre‐
       ated  with   a   simple   touch(1)   command   (for   example,   touch
       /var/log/wtmp).

$ man wtmp

  DESCRIPTION
       The  utmp  file  allows  one to discover information about who is cur‐
       rently using the system.  There may be more users currently using  the
       system, because not all programs use utmp logging.

       Warning:  utmp must not be writable by the user class "other", because
       many system programs (foolishly) depend on its  integrity.   You  risk
       faked  system  logfiles and modifications of system files if you leave
       utmp writable to any user other than the owner and group owner of  the
       file.

D’où il ressort qu’il serait possible d’escamoter /var/log/wtmp en ayant conscience de ce qu’il n’y aurait plus de traces.
Les crackers qui réussiraient à déjouer les logins cherchent justement à effacer les traces des tentatives échouées et réussies …

Bonsoir,

J’étais déjà tombé dessus (ailleurs) mais jamais avec une explication.

[quote=“etxeberrizahar”]# /etc/login.defs - Configuration control definitions for the login package.

[code]# If defined, file which inhibits all the usual chatter during the login

sequence. If a full pathname, then hushed mode will be enabled if the

user’s name or shell are found in the file. If not a full pathname, then

hushed mode will be enabled if the file exists in the user’s home directory.

HUSHLOGIN_FILE .hushlogin
#HUSHLOGIN_FILE /etc/hushlogins[/code][/quote]
Merci :slightly_smiling:

Le but était bien de désactiver l’affichage au login, pas l’écriture du log.