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.

hello.......can any body help me out??

can you please paste your code again in the code tags .;) we need this...

Have you tried these commands manually? Perhaps there is a pause, so you could try adding in the following:

import time

# your code...

time.sleep(5)

The above will pause for 5 seconds. I've found this is a problem sometimes with telnet...

Post your source code (as richieking says...) and we can help more :)

oops... you are using a pause... sorry!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.