Limit the operation example of IP login shell after Linux user exits the system

  
                

Although the Linux system is much safer than the Windows system, it is a good program development environment, but there are still some security risks. After the Linux user exits the system, there will still be multiple IP login risks. How do you limit the IP login shell script after Linux exits? The following small series introduces some examples.

production environment, there may be hosts.allow are modified to allow more ip landing machines other administrators or users; In order to facilitate unified management, we can withdraw the user to modify the unified time The allow and deny files are set to the default settings. At the same time, it can automatically obtain the entire ip segment of the machine with ip to allow login.

test -f /root/.bash_logout && chattr -i /root/.bash_logout

cat 》/root/.bash_logout "EOF

export TERM =xterm

/usr/bin/chattr -i /etc/hosts.allow /etc/hosts.deny

#for hosts.deny

/bin/awk &lsquo ;BEGIN{FS=“[=. ]”;RS=“\ ”};/^IPADDR/{print “sshd:all EXCEPT ”\\$2“. ”\\$3“. ”\\$4“.0/255.255.255.0”}’ /etc/sysconfig/network-scripts/ifcfg-*

Copyright © Windows knowledge All Rights Reserved