六月丁香五月婷婷,丁香五月婷婷网,欧美激情网站,日本护士xxxx,禁止18岁天天操夜夜操,18岁禁止1000免费,国产福利无码一区色费

學(xué)習(xí)啦 > 學(xué)習(xí)電腦 > 操作系統(tǒng) > Linux教程 > Linux用戶退出系統(tǒng)后如何限制IP登錄Shell

Linux用戶退出系統(tǒng)后如何限制IP登錄Shell

時(shí)間: 春健736 分享

Linux用戶退出系統(tǒng)后如何限制IP登錄Shell

  在Linux用戶退出系統(tǒng)后,還是會(huì)有多個(gè)IP登錄的風(fēng)險(xiǎn),那么Linux用戶退出系統(tǒng)后如何限制IP登錄Shell呢?學(xué)習(xí)啦小編分享了Linux用戶退出系統(tǒng)后限制IP登錄Shell的方法,希望對(duì)大家有所幫助。

  Linux用戶退出系統(tǒng)后限制IP登錄Shell方法

  生產(chǎn)環(huán)境中,有可能會(huì)出現(xiàn)被其他管理員或使用者修改hosts.allow允許更多的ip登陸機(jī)器;為了方便統(tǒng)一管理,我們可以在用戶退出的時(shí)候統(tǒng)一修改allow和deny文件成默認(rèn)設(shè)置。同時(shí)也能自動(dòng)獲取機(jī)器所配ip的整個(gè)ip段為允許登陸。

  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 ‘BEGIN{FS=“[=。]”;RS=“\n”};/^IPADDR/{print “sshd:all EXCEPT ”

Linux用戶退出系統(tǒng)后如何限制IP登錄Shell

  在Linux用戶退出系統(tǒng)后,還是會(huì)有多個(gè)IP登錄的風(fēng)險(xiǎn),那么Linux用戶退出系統(tǒng)后如何限制IP登錄Shell呢?學(xué)習(xí)啦小編分享了Linux用戶退出系統(tǒng)后限制IP登錄Shell的方法,希望對(duì)大家有所幫助。

  Linux用戶退出系統(tǒng)后限制IP登錄Shell方法

  生產(chǎn)環(huán)境中,有可能會(huì)出現(xiàn)被其他管理員或使用者修改hosts.allow允許更多的ip登陸機(jī)器;為了方便統(tǒng)一管理,我們可以在用戶退出的時(shí)候統(tǒng)一修改allow和deny文件成默認(rèn)設(shè)置。同時(shí)也能自動(dòng)獲取機(jī)器所配ip的整個(gè)ip段為允許登陸。

  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 ‘BEGIN{FS=“[=。]”;RS=“\n”};/^IPADDR/{print “sshd:all EXCEPT ”

Linux用戶退出系統(tǒng)后如何限制IP登錄Shell

  在Linux用戶退出系統(tǒng)后,還是會(huì)有多個(gè)IP登錄的風(fēng)險(xiǎn),那么Linux用戶退出系統(tǒng)后如何限制IP登錄Shell呢?學(xué)習(xí)啦小編分享了Linux用戶退出系統(tǒng)后限制IP登錄Shell的方法,希望對(duì)大家有所幫助。

  Linux用戶退出系統(tǒng)后限制IP登錄Shell方法

  生產(chǎn)環(huán)境中,有可能會(huì)出現(xiàn)被其他管理員或使用者修改hosts.allow允許更多的ip登陸機(jī)器;為了方便統(tǒng)一管理,我們可以在用戶退出的時(shí)候統(tǒng)一修改allow和deny文件成默認(rèn)設(shè)置。同時(shí)也能自動(dòng)獲取機(jī)器所配ip的整個(gè)ip段為允許登陸。

  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 ‘BEGIN{FS=“[=。]”;RS=“\n”};/^IPADDR/{print “sshd:all EXCEPT ”

Linux用戶退出系統(tǒng)后如何限制IP登錄Shell

  在Linux用戶退出系統(tǒng)后,還是會(huì)有多個(gè)IP登錄的風(fēng)險(xiǎn),那么Linux用戶退出系統(tǒng)后如何限制IP登錄Shell呢?學(xué)習(xí)啦小編分享了Linux用戶退出系統(tǒng)后限制IP登錄Shell的方法,希望對(duì)大家有所幫助。

  Linux用戶退出系統(tǒng)后限制IP登錄Shell方法

  生產(chǎn)環(huán)境中,有可能會(huì)出現(xiàn)被其他管理員或使用者修改hosts.allow允許更多的ip登陸機(jī)器;為了方便統(tǒng)一管理,我們可以在用戶退出的時(shí)候統(tǒng)一修改allow和deny文件成默認(rèn)設(shè)置。同時(shí)也能自動(dòng)獲取機(jī)器所配ip的整個(gè)ip段為允許登陸。

  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 ‘BEGIN{FS=“[=。]”;RS=“\n”};/^IPADDR/{print “sshd:all EXCEPT ”$2“。”$3“。”$4“.0/255.255.255.0”}’ /etc/sysconfig/network-scripts/ifcfg-* | grep -v 127.0.0 | uniq 1》/etc/hosts.deny

  /bin/cat 》》/etc/hosts.deny 《《 iEOF

  sshd:all EXCEPT ip

  iEOF

  #for hosts.allow

  /bin/awk ‘BEGIN{FS=“[=。]”;RS=“\n”};/^IPADDR/{print “sshd:”$2“。”$3“。”$4“.0/255.255.255.0”}’ /etc/sysconfig/network-scripts/ifcfg-* | grep -v 127.0.0 | uniq 1》/etc/hosts.allow

  /bin/cat 》》/etc/hosts.allow 《《 iEOF

  sshd:ip(www.111cn.net)

  iEOF

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

  clear

  EOF

  sh /root/.bash_logout 2》&1 》/dev/null

  例子

  這個(gè)只是檢測(cè)有非法ip登錄到服務(wù)器上就自動(dòng)給運(yùn)維報(bào)警,當(dāng)然也可以改成短信報(bào)警,前提是你有短信網(wǎng)關(guān)。

  #!/bin/bash

  #該腳本作用是檢測(cè)是否有惡意IP登陸服務(wù)器并郵件報(bào)警

  #可以結(jié)合139郵箱以達(dá)到短信及時(shí)通知到手機(jī)的功能

  #適用系統(tǒng)centos5

  Ldate=`which date`

  Lawk=`which awk`

  Llast=`which last`

  Lgrep=`which grep`

  Lsendmail=`which sendmail`

  Lifconfig=`which ifconfig`

  serverip=`$Lifconfig eth0|$Lgrep inet|$Lawk -F : ‘{print

Linux用戶退出系統(tǒng)后如何限制IP登錄Shell

  在Linux用戶退出系統(tǒng)后,還是會(huì)有多個(gè)IP登錄的風(fēng)險(xiǎn),那么Linux用戶退出系統(tǒng)后如何限制IP登錄Shell呢?學(xué)習(xí)啦小編分享了Linux用戶退出系統(tǒng)后限制IP登錄Shell的方法,希望對(duì)大家有所幫助。

  Linux用戶退出系統(tǒng)后限制IP登錄Shell方法

  生產(chǎn)環(huán)境中,有可能會(huì)出現(xiàn)被其他管理員或使用者修改hosts.allow允許更多的ip登陸機(jī)器;為了方便統(tǒng)一管理,我們可以在用戶退出的時(shí)候統(tǒng)一修改allow和deny文件成默認(rèn)設(shè)置。同時(shí)也能自動(dòng)獲取機(jī)器所配ip的整個(gè)ip段為允許登陸。

  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 ‘BEGIN{FS=“[=。]”;RS=“\n”};/^IPADDR/{print “sshd:all EXCEPT ”\$2“。”\$3“。”\$4“.0/255.255.255.0”}’ /etc/sysconfig/network-scripts/ifcfg-* | grep -v 127.0.0 | uniq 1》/etc/hosts.deny

  /bin/cat 》》/etc/hosts.deny 《《 iEOF

  sshd:all EXCEPT ip

  iEOF

  #for hosts.allow

  /bin/awk ‘BEGIN{FS=“[=。]”;RS=“\n”};/^IPADDR/{print “sshd:”\$2“。”\$3“。”\$4“.0/255.255.255.0”}’ /etc/sysconfig/network-scripts/ifcfg-* | grep -v 127.0.0 | uniq 1》/etc/hosts.allow

  /bin/cat 》》/etc/hosts.allow 《《 iEOF

  sshd:ip(www.111cn.net)

  iEOF

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

  clear

  EOF

  sh /root/.bash_logout 2》&1 》/dev/null

  例子

  這個(gè)只是檢測(cè)有非法ip登錄到服務(wù)器上就自動(dòng)給運(yùn)維報(bào)警,當(dāng)然也可以改成短信報(bào)警,前提是你有短信網(wǎng)關(guān)。

  #!/bin/bash

  #該腳本作用是檢測(cè)是否有惡意IP登陸服務(wù)器并郵件報(bào)警

  #可以結(jié)合139郵箱以達(dá)到短信及時(shí)通知到手機(jī)的功能

  #適用系統(tǒng)centos5

  Ldate=`which date`

  Lawk=`which awk`

  Llast=`which last`

  Lgrep=`which grep`

  Lsendmail=`which sendmail`

  Lifconfig=`which ifconfig`

  serverip=`$Lifconfig eth0|$Lgrep inet|$Lawk -F : ‘{print $2}’|$Lawk ‘{print $1}’`

  cutdate=`$Ldate |$Lawk ‘{print $1“ ”$2“ ”$3}’`

  hackerip=`$Llast|$Lgrep “$cutdate”|$Lawk ‘{print $3}’|$Lgrep -v 192.168.1x.xx`

  if [ -z $hackerip ]

  then

  exit

  else

  for logip in $hackerip

  do

  echo “hacker ip is $logip already login $serverip”|mail -s “SOS” rocdk890@139.com

  done

  fi

  上面就是Linux用戶退出系統(tǒng)后限制IP登錄Shell腳本的實(shí)例介紹了,限制IP登錄也方便統(tǒng)一管理,有需要的朋友可以嘗試一下。
 

看過(guò)“Linux用戶退出系統(tǒng)后如何限制IP登錄Shell”的人還看了:

1.怎樣突破TCP-IP過(guò)濾防火墻進(jìn)入內(nèi)網(wǎng)

2.如何查閱Linux系統(tǒng)正在使用的Shell版本

3.linux操作系統(tǒng)安全加固

4.linux操作系統(tǒng)安全設(shè)置

5.linux系統(tǒng)命令及其使用詳解

6.LINUX操作系統(tǒng)的IP地址如何配置

}’|$Lawk ‘{print class="main">