comp.lang.tcl
[Top] [All Lists]

How to interact with sudo after ssh the remote server?

Subject: How to interact with sudo after ssh the remote server?
From: wqhhust
Date: Thu, 29 May 2008 22:40:26 -0700 PDT
Newsgroups: comp.lang.tcl

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

<Prev in Thread] Current Thread [Next in Thread>
  • How to interact with sudo after ssh the remote server?, wqhhust <=
Privacy Policy