Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #36974
| Path | csiph.com!newsfeed.hal-mli.net!feeder3.hal-mli.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!newsreader4.netcologne.de!news.netcologne.de!newsfeed.freenet.ag!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail |
|---|---|
| Return-Path | <maniandram01@gmail.com> |
| X-Original-To | python-list@python.org |
| Delivered-To | python-list@mail.python.org |
| X-Spam-Status | OK 0.000 |
| X-Spam-Evidence | '*H*': 1.00; '*S*': 0.00; 'subject:: [': 0.03; 'broken': 0.03; 'output': 0.04; 'binary': 0.05; 'error:': 0.05; 'mrab': 0.05; 'subject:password': 0.05; 'that?': 0.05; 'python': 0.09; 'correct,': 0.09; 'friday,': 0.09; 'incorrect': 0.09; 'may,': 0.09; 'nameerror:': 0.09; 'path.': 0.09; 'sub': 0.09; 'to:addr:comp.lang.python': 0.09; 'cc:addr:python-list': 0.10; 'subject:python': 0.11; 'echo': 0.16; 'guessing': 0.16; 'happened?': 0.16; 'subprocess': 0.16; 'tty': 0.16; 'using,': 0.16; 'wrote:': 0.17; 'copied': 0.17; 'jan': 0.18; 'skip:" 30': 0.20; 'import': 0.21; 'not,': 0.21; 'password.': 0.22; 'defined': 0.22; 'cc:2**0': 0.23; 'work.': 0.23; 'somebody': 0.23; 'cc:no real name:2**0': 0.24; 'connected': 0.24; 'command': 0.24; 'tried': 0.25; 'cc:addr:python.org': 0.25; 'header:In-Reply-To:1': 0.25; 'header:User-Agent:1': 0.26; 'guess': 0.27; 'first.': 0.27; "doesn't": 0.28; 'correct': 0.28; 'received:209.85.212': 0.28; 'actual': 0.28; "d'aprano": 0.29; 'steven': 0.29; 'probably': 0.29; 'fri,': 0.30; 'code': 0.31; 'could': 0.32; 'traceback': 0.33; 'received:google.com': 0.34; 'entered': 0.34; 'wrong': 0.34; 'whatever': 0.35; 'doing': 0.35; 'expected': 0.35; "won't": 0.35; 'received:209.85': 0.35; 'but': 0.36; "didn't": 0.36; 'execute': 0.37; 'uses': 0.37; 'received:209': 0.37; 'some': 0.38; 'instead': 0.39; 'skip:" 10': 0.40; 'think': 0.40; 'your': 0.60; 'love': 0.63; 'show': 0.63; '2013': 0.84; 'mean.': 0.91; 'results,': 0.91 |
| X-Received | by 10.50.203.9 with SMTP id km9mr340905igc.7.1358484357320; Thu, 17 Jan 2013 20:45:57 -0800 (PST) |
| Newsgroups | comp.lang.python |
| Date | Thu, 17 Jan 2013 20:45:57 -0800 (PST) |
| In-Reply-To | <mailman.609.1358481637.2939.python-list@python.org> |
| Complaints-To | groups-abuse@google.com |
| Injection-Info | glegroupsg2000goo.googlegroups.com; posting-host=122.172.199.38; posting-account=uPFZNQoAAAAm9w7z13q1SjWNKNjztdcD |
| References | <mailman.608.1358477462.2939.python-list@python.org> <50f8bd80$0$30003$c3e8da3$5496439d@news.astraweb.com> <mailman.609.1358481637.2939.python-list@python.org> |
| User-Agent | G2/1.0 |
| X-Google-Web-Client | true |
| X-Google-IP | 122.172.199.38 |
| MIME-Version | 1.0 |
| Subject | Re: [HELP!] a doubt about entering password in python |
| From | Ramchandra Apte <maniandram01@gmail.com> |
| To | comp.lang.python@googlegroups.com |
| Content-Type | text/plain; charset=ISO-8859-1 |
| Cc | python-list@python.org |
| X-BeenThere | python-list@python.org |
| X-Mailman-Version | 2.1.15 |
| Precedence | list |
| List-Id | General discussion list for the Python programming language <python-list.python.org> |
| List-Unsubscribe | <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe> |
| List-Archive | <http://mail.python.org/pipermail/python-list/> |
| List-Post | <mailto:python-list@python.org> |
| List-Help | <mailto:python-list-request@python.org?subject=help> |
| List-Subscribe | <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe> |
| Message-ID | <mailman.610.1358484365.2939.python-list@python.org> (permalink) |
| Lines | 74 |
| NNTP-Posting-Host | 2001:888:2000:d::a6 |
| X-Trace | 1358484365 news.xs4all.nl 6964 [2001:888:2000:d::a6]:50527 |
| X-Complaints-To | abuse@xs4all.nl |
| Xref | csiph.com comp.lang.python:36974 |
Show key headers only | View raw
On Friday, January 18, 2013 9:30:29 AM UTC+5:30, MRAB wrote:
> On 2013-01-18 03:12, Steven D'Aprano wrote:
>
> > On Fri, 18 Jan 2013 10:49:30 +0800, douxin wrote:
>
> >
>
> >> i use Popen to execute "su -c 'fdisk -l'" in sub process,and
>
> >> assigned subprocess.PIPE to stdin,stdout i tried to enter password
>
> >> by doing "stdin.write("password"+"\n")" and i expected i could get
>
> >> the output of "fdisk -l" by doing "stdout.read()"
>
> >> it didn't work.
>
> >>
>
> >> will somebody tell me what is going on with that?
>
> >
>
> > Would you like us to guess what happened? I love guessing games!
>
> >
>
> > My guess is that it output "su: incorrect password", which means you have
>
> > the wrong password. Is that it?
>
> >
>
> > If not, my guess is that it output "fdisk: command not found", in which
>
> > case your system is broken and the fdisk binary is missing or not on the
>
> > PATH. Am I close?
>
> >
>
> > Last guess: you got a Python traceback with an error:
>
> >
>
> > NameError: name 'subprocess' is not defined
>
> >
>
> > You need to import the subprocess first.
>
> >
>
> >
>
> > If none of my guesses are correct, could we have some hints? Perhaps show
>
> > us the actual code you are using, and the actual results, copied and
>
> > pasted exactly.
>
> >
>
> It may, of course, be that for security reasons it won't accept a
>
> password from
>
> whatever happens to be connected to stdin, but instead insists that it's
>
> entered
>
> directly from the keyboard, if you see what I mean.
I think you are correct - su uses some tty magic to stop ECHO and probably doesn't read the password from stdin.
Back to comp.lang.python | Previous | Next — Previous in thread | Find similar | Unroll thread
[HELP!] a doubt about entering password in python douxin <wq-doux@cn.fujitsu.com> - 2013-01-18 10:49 +0800
Re: [HELP!] a doubt about entering password in python Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2013-01-18 03:12 +0000
Re: [HELP!] a doubt about entering password in python MRAB <python@mrabarnett.plus.com> - 2013-01-18 04:00 +0000
Re: [HELP!] a doubt about entering password in python Ramchandra Apte <maniandram01@gmail.com> - 2013-01-17 20:45 -0800
Re: [HELP!] a doubt about entering password in python Chris Angelico <rosuav@gmail.com> - 2013-01-18 17:36 +1100
Re: [HELP!] a doubt about entering password in python Ramchandra Apte <maniandram01@gmail.com> - 2013-01-17 20:45 -0800
csiph-web