telnetlib is helping me to connect to remote host and do the user login.
but, when i try doing the super user login, it hangs
...............
..............
...............
User="abc"
Password="abc"
Superuser_id="yyy"
su_passwd="xxx"
#-- establish a telnet connection to all the remote hosts in the list except the host running script
telnet=telnetlib.Telnet(Host)
telnet.read_until("login:")
telnet.write(User+'\r\n')
telnet.read_until("Password:")
telnet.write(Password+'\r\n')
time.sleep(5)
print telnet.read_until('[abc@xyz abc]$ ')
telnet.write(Superuser_id+'\r\n')
print telnet.read_until("Password:")
telnet.write(su_passwd+'\r\n')
time.sleep(5)
print telnet.read_until('[root@xyz abc]#')
telnet.write("cd /folder1/folder2/%s\n"%version)
.............
...........
...........
any idea why it hangs and doesnt do a cd:?
it works fine when i don't try to do a super user login.