Path: csiph.com!news.mixmin.net!feeds.phibee-telecom.net!newsfeed.xs4all.nl!newsfeed8.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.002 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'cc:addr:python-list': 0.09; '===========': 0.09; 'received:openend.se': 0.09; 'received:theraft.openend.se': 0.09; 'str,': 0.09; 'subject:while': 0.09; 'sys.stdout': 0.09; 'typeerror:': 0.09; 'question.': 0.13; '>on': 0.16; 'cc:addr:lac': 0.16; 'cc:addr:openend.se': 0.16; 'from:addr:lac': 0.16; 'from:addr:openend.se': 0.16; 'from:name:laura creighton': 0.16; 'message-id:@fido.openend.se': 0.16; 'readable': 0.16; 'received:fido': 0.16; 'received:fido.openend.se': 0.16; 'simplifies': 0.16; 'subject:issue': 0.16; 'subject:ssh': 0.16; 'wrote:': 0.16; 'bytes': 0.18; 'laura': 0.18; 'hack': 0.18; '2015': 0.20; 'cc:addr:python.org': 0.20; 'cc:2**1': 0.22; 'sep': 0.22; 'simpler': 0.22; 'cc:no real name:2**0': 0.22; '(or': 0.23; 'all.': 0.24; 'chris': 0.26; 'error': 0.27; 'disk': 0.27; 'actual': 0.28; 'about.': 0.29; 'embed': 0.29; 'received:se': 0.29; 'transaction': 0.30; 'code': 0.30; 'getting': 0.33; 'tue,': 0.34; 'best,': 0.35; 'could': 0.35; 'follows:': 0.35; 'skip:> 10': 0.35; 'but': 0.36; 'child': 0.36; 'pm,': 0.36; 'subject:: ': 0.37; 'missing': 0.37; 'charset:us-ascii': 0.37; 'things': 0.38; 'anything': 0.38; 'log': 0.38; 'means': 0.39; 'rather': 0.39; 'where': 0.40; 'some': 0.40; 'him': 0.60; 'your': 0.60; 'header :Message-Id:1': 0.61; 'policy': 0.63; 'soul': 0.72; '+1000,': 0.84; '=====': 0.84; '============': 0.84; 'header:In-reply-to:1': 0.84; 'password;': 0.84; 'subject:doing': 0.84 To: Chris Angelico cc: "python-list@python.org" , lac@openend.se From: Laura Creighton Subject: Re: issue while doing pexpect ssh In-reply-to: References: <3f4642c2-d548-4089-87c2-f3abb4ccb224@googlegroups.com> Comments: In-reply-to Chris Angelico message dated "Tue, 08 Sep 2015 23:57:41 +1000." MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <980.1441730620.1@fido> Date: Tue, 08 Sep 2015 18:43:40 +0200 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.3.9 (theraft.openend.se [82.96.5.2]); Tue, 08 Sep 2015 18:43:42 +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: 32 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1441730631 news.xs4all.nl 23845 [2001:888:2000:d::a6]:43184 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:96137 In a message of Tue, 08 Sep 2015 23:57:41 +1000, Chris Angelico writes: >On Tue, Sep 8, 2015 at 9:37 PM, wrote: >> Some where i am missing simple logic.... :) >> >> ===== >> child = pexpect.spawn('ssh hari@hostname') >> child.logfile = sys.stdout >> child.expect('hari\'s Password: ') >> ===== >> >> getting error as follows: >> ============ >> child.expect('hari\'s Password: ') >> TypeError: must be str, not bytes >> =========== > >Laura's already answered your actual question. But I would recommend >using public key login rather than keying in a password; it's a lot >more secure, as it means you don't have to embed a password in your >source code (or at very best, on your hard disk in some other readable >and decryptable way). It also simplifies the transaction >significantly. > >ChrisA This poor soul cannot login at all. He needs this hack to let him su some-other-user because of a draconian policy he cannot do anything about. If he could just log in, one heck of a lot of other things would be simpler for him ... Laura