package:
tcl
tclx
expect
passwd.exp
#!/usr/bin/expect
spawn /usr/bin/passwd [lindex $argv 0]
set password [lindex $argv 1]
expect "password:"
send "$password\r"
expect "password:"
send "$password\r"
expect eof
change.sh
#!/bin/bash
PASSWD1="`/usr/bin/mkpasswd`"
/usr/local/bin/passwd.exp root $PASSWD1
阅读(712) | 评论(0) | 转发(0) |