File size: 196 Bytes
f04f988
c21bd4d
81e4196
 
 
ddeb35d
f04f988
427ddaf
c21bd4d
cce33a9
f04f988
1
2
3
4
5
6
7
8
9
10
11
#!/usr/bin/expect

set user [lindex $argv 0]
set password [lindex $argv 1]
set command [lindex $argv 2]

log_user 1;
spawn su - $user -c "$command"
expect "Password:"
send "$password\r"
expect eof