zf-crazy
1.yum install expect
需要使用这个命令
2.编写 shell脚本 vi test.sh
#!/bin/sh
echo \'su user[root]!\'

expect -c "
spawn su - root
expect \":\"
send \"your password\r\"
interact
"
echo "ok!"
~    
3.执行脚本./test.sh

 

 亲测~~有效...~~~


 

  

分类:

技术点:

相关文章:

  • 2021-12-15
  • 2021-12-07
  • 2021-12-15
  • 2021-07-05
  • 2021-12-15
  • 2021-05-19
猜你喜欢
  • 2021-12-15
  • 2021-12-15
  • 2021-11-22
  • 2021-12-15
  • 2021-12-05
  • 2021-10-21
相关资源
相似解决方案