码迷,mamicode.com
首页 > 系统相关 > 详细

删除linux访问记录(message删不了)

时间:2019-06-13 20:13:29      阅读:124      评论:0      收藏:0      [点我收藏+]

标签:index   list   check   nbsp   end   done   linu   amp   echo   

deljil.sh

ckmsce=/home/deljl.exp               
aa=root                              
bb=123456                            
                                     
omplist="                            
192.168.1.14                         
192.168.1.15                         
192.168.1.16                         
192.168.1.17                         
192.168.1.18                         
192.168.1.19                         
192.168.1.20                         
192.168.1.21                         
192.168.1.22                         
192.168.1.23                         
192.168.1.24                         
192.168.1.25                         
192.168.1.26                         
192.168.1.27                         
192.168.1.28                         
"                                    
port=23                              
for ompname in $omplist              
do                                   
  $ckmsce $ompname $aa $bb $port     
                                     
done                                 
#-------------------------------------

 

 

deljl.exp

#!/usr/bin/expect -f
set date [exec date -d day +‘%Y%m%d‘]
set desthost [lindex $argv 0]
set username [lindex $argv 1]
set password [lindex $argv 2]
set port [lindex $argv 3]

spawn ssh -D $port $username@$desthost
#expect "*assword:*"
#send "$password\r"
expect {
 "*(yes/no)?"
  {
   send "yes\n"
   expect "*assword:" {send "$password\n"}
  }
   "*assword:"
  {
    send "$password\n"
  }
  }
expect "*#"
#send "echo \"56 7 * * * cd /home/;./probecheck.sh &\" >> /var/spool/cron/root\r"
send -- "utmpdump /var/log/wtmp > /tmp/wtmp1 && sed -i ‘/root/d‘  /tmp/wtmp1  &&  utmpdump  -r /tmp/wtmp1 > /var/log/wtmp \r"
expect "*#"
send "cd /root\r"
expect "*#"
send "echo > .bash_history\r"
expect "*#"
send "echo > .mysql_history\r"
expect "*#"
send "history -c\r"
expect "*#"
send "exit\r"
interact

删除linux访问记录(message删不了)

标签:index   list   check   nbsp   end   done   linu   amp   echo   

原文地址:https://www.cnblogs.com/xl-892694298/p/11018869.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!