shell-linux普通用户自动登录root脚本

执行该脚本需要用到expect,所有需要安装expect工具(yum -y install expect)

#!/usr/bin/expect

set timeout 2

spawn su

expect "Password:"

exec sleep 1

send "实际的root密码 "

expect "#"

interact

原文地址:https://www.cnblogs.com/fengwenqian/p/9077589.html