issue while doing pexpect ssh

Laura Creighton lac at
Wed Sep 9 12:45:56 CEST 2015

In a message of Wed, 09 Sep 2015 01:58:30 -0700, harirammanohar159 at wr

>Thank you for spawnu, now i got stuck with freezing issue similar to it is not returing to the shell prompt...its on waiting...i had to press ctrl+c
>child.sendline('su - user1')
>child.sendline('pwd; hostname')

>WARNING. You have accessed a private computer system.
<lots more threats and stuff>

Any doubts we had about whether the computer policy authorities
as this place are 'nuttier than 2 trees full of squirrels' are
now put to rest.  I just hope I am not helping you do things that
is going to end up with them trying to put you in jail.  Poor you.

>su - user1
>lsTotal users logged in under your name (via BoKS): 3 (2 on this host)
>Total users logged in (via BoKS): 8324 (2 on this host)
>-bash-4.1$ ls
>-bash-4.1$ su - user1

Instead of waiting for that bash-4.1 prompt
after you issue your su, issue whoami
and wait to see if it returns user1.

That way we can see if the problem is with expect waiting for the prompt
which for some reason it is not seeing, or whether it is just lost, lost,

Also, for informational purposes try your su without the '-'
just "su user1", and see if it is some part of the 'provide an environment
similar to what the user would get if the user logged in directly'
ability of su that is confusing things.


More information about the Python-list mailing list