#Linux--Log The IP information of each user after login, and other operation information, append
vim/etc/profileps1= "' WhoAmI ' @ ' hostname ': ' [$PWD] '
(Linux system prompt is defined with system variable PS1)
History
(Who-u am I will show the system logged in users and landing from which IP landed in, here after filtering on the value of a login incoming IP)
user_ip= ' who-u am I 2>/dev/null| awk ' {print $NF} ' |sed-e ' s/[()]//g "if [" $USER _ip "=" "]thenuser_ip= ' hostname ' FIIF [! -d/tmp/ruige]thenmkdir/tmp/ruigechmod 777/tmp/ruigefiif [!-d/tmp/ruige/${logname}]thenmkdir/tmp/ruige/${logname} chmod 300/tmp/ruige/${logname}fiexport histsize=4096dt= ' date ' +%y:%m:%d%r ' export histfile= '/tmp/ruige/${logname}/ ${USER_IP} ruige. $DT "chmod 600/tmp/ruige/${logname}/*ruige* 2>/dev/null
This article is from the "A-B-C" blog, reproduced please contact the author!
linux--record the IP information of each user after login, there are other operation information