Nella mia azienda, quando accedo ad alcuni server, vengono visualizzati il mio ultimo accesso e un enorme banner:
[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]$
Ovviamente, non voglio che questo enorme banner venga visualizzato ogni volta che accedo, ma vorrei mantenere visualizzati l'ora dell'ultimo accesso e l'host .
Se utilizzo touch ~/.hushlogin
, il banner non viene visualizzato ma perdo anche le
ultime informazioni di accesso . In effetti, non viene visualizzato nulla:
ssh the-server
[email protected]$
Come posso rimuovere il banner ma mantenere l'ora dell'ultimo accesso e l'host, in questo modo:
ssh the-server
Last login: Mon Feb 8 18:54:36 2016 from my-laptop.company.com
[email protected]$
Risposta accettata:
Un modo sarebbe aggiungere quanto segue a ~/.ssh/rc
, che contiene i comandi da eseguire quando ssh nella macchina:
lastlog -u $USER | perl -lane 'END{print "Last login: @F[3..6] $F[8] from $F[2]"}'
Il comando otterrà l'ora del tuo ultimo accesso da lastlogin
e quindi formattalo in modo che assomigli alla versione originale. Ora puoi touch ~/.hushlogin
e vedrai ancora quel messaggio.