Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.c > #103415

Re: Masking the password entered by the user

Path csiph.com!eternal-september.org!feeder.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail
From Keith Thompson <kst-u@mib.org>
Newsgroups comp.lang.c
Subject Re: Masking the password entered by the user
Date Tue, 07 Feb 2017 12:16:46 -0800
Organization None to speak of
Lines 32
Message-ID <lnfujp21u9.fsf@kst-u.example.com> (permalink)
References <6fb9a4db-5cba-479c-8ee6-82b7146a2e38@googlegroups.com> <a19ca74e-265a-b58f-44aa-46c313f3571c@verizon.net> <f32d1254-7dcc-4044-93b4-64e77a06a048@googlegroups.com>
Mime-Version 1.0
Content-Type text/plain; charset=us-ascii
Injection-Info mx02.eternal-september.org; posting-host="04056ce4c9c7dd85ee7ce897aab9f52a"; logging-data="23918"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1/slZHzyoe0b/h7gHL4R9g/"
User-Agent Gnus/5.13 (Gnus v5.13) Emacs/23.1 (gnu/linux)
Cancel-Lock sha1:w+MC1V3o2t6KQffZivg7zh2Hnc0= sha1:0s0SMvv7qn9O/qQFnZQa+lw0q4o=
Xref csiph.com comp.lang.c:103415

Show key headers only | View raw


Alla _ <modelling.data@gmail.com> writes:
[...]
> I see. Then I just leave it as it is, keeping in mind that I have to constantly
> change my root password, as the one I have now I have used numerous
> times and it's there on the Terminal. 

Not really a C issue, but I personally would avoid anything that leaves
a password, particularly a root password, on the screen in plain text.

If your application needs to ask for a password, I suggest finding a way
to do it using POSIX features.  Some of the methods suggested in FAQ
19.1 are probably POSIX-compliant.  The most straightforward approach
is probably something like:

    fputs("Enter password: ", stdout);
    fflush(stdout);
    system("stty -echo");
    fgets(password, sizeof password, stdin);
    system("stty echo");
    /* deal with '\n' */

It might be better to do something a bit lower level.
comp.unix.programmer would be a good place to ask (check for a FAQ
list first, this kind of thing would likely be covered).

[...]

-- 
Keith Thompson (The_Other_Keith) kst-u@mib.org  <http://www.ghoti.net/~kst>
Working, but not speaking, for JetHead Development, Inc.
"We must do something.  This is something.  Therefore, we must do this."
    -- Antony Jay and Jonathan Lynn, "Yes Minister"

Back to comp.lang.c | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

Masking the password entered by the user Alla _ <modelling.data@gmail.com> - 2017-02-07 09:19 -0800
  Re: Masking the password entered by the user Keith Thompson <kst-u@mib.org> - 2017-02-07 09:34 -0800
  Re: Masking the password entered by the user "James R. Kuyper" <jameskuyper@verizon.net> - 2017-02-07 12:54 -0500
    Re: Masking the password entered by the user Alla _ <modelling.data@gmail.com> - 2017-02-07 10:21 -0800
      Re: Masking the password entered by the user Keith Thompson <kst-u@mib.org> - 2017-02-07 12:16 -0800
  Re: Masking the password entered by the user luser droog <luser.droog@gmail.com> - 2017-02-07 11:10 -0800
  Re: Masking the password entered by the user Ben Bacarisse <ben.usenet@bsb.me.uk> - 2017-02-07 19:39 +0000
    Re: Masking the password entered by the user Alla _ <modelling.data@gmail.com> - 2017-02-07 12:21 -0800

csiph-web