|
|
My daily job is connecting to ORACLE_SERVER using ssh using my own
account such as qihua,
ssh qihua@ORACLE_SERVER
after providing the password and login successfully, switch to user
oracle
sudo su - oracle
then providing the same password again. After that I could do my job.
It is very hard to ask the unix team to install expect on
ORACLE_SERVER. So instead I installed a solaris on my vmware and use
ssh to connect DB_SERVER. But I could get the sudo command run
smoothly. The code is as below.
spawn ssh qihua@ORACLE_SERVER
expect {
"Are you sure you want to continue connecting" {send "yes\n"}
"Password:" {send "password\n"}
}
send "sudo su - oracle"
expect "Password:"
send "password\n" ======> seems this doesn't work
|
|