Log all IP user operation logs by login IP

  
 

Linux user operation records generally use the history to view the history, but if someone deletes important data because of a mistake, the history command will not be useful in this case. The following methods can be used to log the log-in IP address and all user logins!

Add the following script code to the end of the /etc/profile configuration file. The following script is found on the Internet, the original author does not know. However, the time variable of the original script has an error and cannot record the time. I tested and found the fix:

PS1="`whoami`@`hostname`:"'[$PWD]'historyUSER_IP=`who -u am i 2>/dev/null

Copyright © Windows knowledge All Rights Reserved