Wenn ich mich in meinem Unternehmen bei einigen Servern anmelde, werden meine letzte Anmeldung und ein riesiges Banner angezeigt:
[email protected]$ ssh the-server
Last login: Mon Feb 8 18:54:36 2016 from my-laptop.company.com
************************************************************************
* *
* C O M P A N Y I N F O R M A T I O N S Y S T E M S *
* *
* !WARNING! Your connection has been logged !WARNING! *
* *
* This system is for the use of authorized personnel only. *
* Individuals using this *computer system without authorization, *
* or in excess of their authority as determined by the Company *
* Code of Ethics and Acceptable Use Policy, are subject to having all *
* of their activities on this system monitored, recorded and/or *
* terminated by system personnel. *
* If such monitoring reveals possible evidence of criminal activity, *
* Company may provide said evidence to law enforcement officials, *
* in compliance with its confidentiality obligations and all *
* applicable national laws/regulations with regards to data privacy. *
* *
* This device is maintained by Company Department *
* [email protected] *
************************************************************************
[email protected]$
Natürlich möchte ich nicht, dass dieses riesige Banner jedes Mal angezeigt wird, wenn ich mich anmelde, aber ich möchte, dass die letzte Anmeldezeit und der Host angezeigt bleiben .
Wenn ich touch ~/.hushlogin
verwende , das Banner wird nicht angezeigt, aber ich verliere auch die
letzten Anmeldeinformationen . Tatsächlich wird überhaupt nichts angezeigt:
ssh the-server
[email protected]$
Wie entferne ich das Banner, behalte aber die letzte Anmeldezeit und den Host wie folgt:
ssh the-server
Last login: Mon Feb 8 18:54:36 2016 from my-laptop.company.com
[email protected]$
Akzeptierte Antwort:
Eine Möglichkeit wäre, Folgendes zu ~/.ssh/rc
hinzuzufügen , das Befehle enthält, die ausgeführt werden, wenn Sie per SSH auf die Maschine zugreifen:
lastlog -u $USER | perl -lane 'END{print "Last login: @F[3..6] $F[8] from $F[2]"}'
Der Befehl holt sich die Uhrzeit Ihres letzten Logins aus lastlogin
und formatieren Sie es dann so, dass es wie die Originalversion aussieht. Sie können jetzt touch ~/.hushlogin
und Sie werden diese Nachricht immer noch sehen.