Path: csiph.com!news.mixmin.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed7.news.xs4all.nl!news.tele.dk!news.tele.dk!small.news.tele.dk!newsgate.cistron.nl!newsgate.news.xs4all.nl!nzpost1.xs4all.net!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.013 X-Spam-Evidence: '*H*': 0.97; '*S*': 0.00; 'cc:addr:python-list': 0.09; "'-'": 0.09; 'lost.': 0.09; 'received:openend.se': 0.09; 'received:theraft.openend.se': 0.09; 'subject:while': 0.09; 'trees': 0.09; 'wed,': 0.15; 'things.': 0.15; '(via': 0.16; 'cc:addr:lac': 0.16; 'cc:addr:openend.se': 0.16; 'ctrl+c': 0.16; 'from:addr:lac': 0.16; 'from:addr:openend.se': 0.16; 'from:name:laura creighton': 0.16; 'host)': 0.16; 'message- id:@fido.openend.se': 0.16; 'received:fido': 0.16; 'received:fido.openend.se': 0.16; 'skip:> 20': 0.16; 'subject:issue': 0.16; 'subject:ssh': 0.16; 'laura': 0.18; 'shell': 0.18; '2015': 0.20; 'cc:addr:python.org': 0.20; 'purposes': 0.20; 'cc:2**1': 0.22; 'sep': 0.22; 'trying': 0.22; '-0700,': 0.29; 'received:se': 0.29; 'environment': 0.29; 'cc:no real name:2**1': 0.29; 'problem': 0.33; 'similar': 0.33; 'skip:> 10': 0.35; 'instead': 0.36; 'subject:: ': 0.37; 'expect': 0.37; 'charset:us-ascii': 0.37; 'things': 0.38; 'end': 0.39; 'system.': 0.39; 'some': 0.40; 'waiting': 0.60; 'your': 0.60; 'press': 0.61; 'hope': 0.61; 'header:Message-Id:1': 0.61; 'email addr:gmail.com': 0.62; 'policy': 0.63; 'you.': 0.64; 'accessed': 0.66; 'helping': 0.67; 'prompt': 0.79; '>total': 0.84; 'confusing': 0.84; 'doubts': 0.84; 'header:In-reply-to:1': 0.84; 'lost,': 0.84; 'seeing,': 0.84; 'subject:doing': 0.84; 'authorities': 0.95 To: harirammanohar159@gmail.com cc: python-list@python.org, lac@openend.se From: Laura Creighton Subject: Re: issue while doing pexpect ssh In-reply-to: <789c4865-9526-4592-bcaa-9b83955b41d8@googlegroups.com> References: <3f4642c2-d548-4089-87c2-f3abb4ccb224@googlegroups.com> <789c4865-9526-4592-bcaa-9b83955b41d8@googlegroups.com> Comments: In-reply-to harirammanohar159@gmail.com message dated "Wed, 09 Sep 2015 01:58:30 -0700." MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <9929.1441795556.1@fido> Content-Transfer-Encoding: quoted-printable Date: Wed, 09 Sep 2015 12:45:56 +0200 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.3.9 (theraft.openend.se [82.96.5.2]); Wed, 09 Sep 2015 12:46:01 +0200 (CEST) X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.20+ Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 52 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1441795576 news.xs4all.nl 23780 [2001:888:2000:d::a6]:40111 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:96183 In a message of Wed, 09 Sep 2015 01:58:30 -0700, harirammanohar159@gmail.c= om wr ites: >Thank you for spawnu, now i got stuck with freezing issue similar to it i= s not returing to the shell prompt...its on waiting...i had to press ctrl+= c > >=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D >child.sendline(password) >child.expect('-bash-4.1$') >child.sendline('ls') >print(child.before) >child.sendline('su - user1') >child.expect('-bash-4.1$') >child.sendline('pwd; hostname') >print(child.before) >child.close() >WARNING. You have accessed a private computer system. 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 >-bash-4.1$ Okay. 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, 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. Laura