LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Security
User Name
Password
Linux - Security This forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.

Notices


Reply
  Search this Thread
Old 03-07-2012, 09:42 AM   #1
TITiAN
Member
 
Registered: Mar 2008
Location: NRW, Germany
Distribution: Arch Linux, using KDE/Plasma
Posts: 392

Rep: Reputation: 49
Is there a command like "read" that doesn't show the input?


Hi
I have a line in an init script similar to this:
Code:
read password; echo "$password" | encfs -S bla bla bla
As you would guess, "encfs" accepts the $password variable that is read and then piped to encfs.
(The reason why I use the pipe is that in the actual script I use 'su -u user', which somehow disables the normal input from the commandline :$).
My question, guess it from the context and the title, is: Is there another program that acts like 'read', but suppresses the input from being mirrored in the shell (i.e., doesn't show my password) ? If not, is the an applicable way?
TIA
 
Old 03-07-2012, 09:45 AM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
"man read" says use the -s flag.
 
Old 03-07-2012, 10:14 AM   #3
TITiAN
Member
 
Registered: Mar 2008
Location: NRW, Germany
Distribution: Arch Linux, using KDE/Plasma
Posts: 392

Original Poster
Rep: Reputation: 49
interestingly, it doesn't:
Quote:
DESCRIPTION
The read utility shall read a single line from standard input.

By default, unless the -r option is specified, backslash ( '\' ) shall act as an escape character, as described in Escape Character (Backslash) . If standard input is a terminal device and the invoking
shell is interactive, read shall prompt for a continuation line when:

* The shell reads an input line ending with a backslash, unless the -r option is specified.

* A here-document is not terminated after a <newline> is entered.

The line shall be split into fields as in the shell (see Field Splitting ); the first field shall be assigned to the first variable var, the second field to the second variable var, and so on. If there are
fewer var operands specified than there are fields, the leftover fields and their intervening separators shall be assigned to the last var. If there are fewer fields than vars, the remaining vars shall be
set to empty strings.

The setting of variables specified by the var operands shall affect the current shell execution environment; see Shell Execution Environment . If it is called in a subshell or separate utility execution
environment, such as one of the following:


(read foo)
nohup read ...
find . -exec read ... \;

it shall not affect the shell variables in the caller's environment.

OPTIONS
The read utility shall conform to the Base Definitions volume of IEEE Std 1003.1-2001, Section 12.2, Utility Syntax Guidelines.

The following option is supported:

-r Do not treat a backslash character in any special way. Consider each backslash to be part of the input line.


OPERANDS
The following operand shall be supported:

var The name of an existing or nonexisting shell variable.


STDIN
the -s flag does this, though
thanks
 
Old 03-07-2012, 10:17 AM   #4
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
heh. ok... MY "man read" says....
 
Old 03-07-2012, 11:57 AM   #5
TITiAN
Member
 
Registered: Mar 2008
Location: NRW, Germany
Distribution: Arch Linux, using KDE/Plasma
Posts: 392

Original Poster
Rep: Reputation: 49
i don't know what's wrong with my man page, that's what i meant, sorry; thank you for solving
 
Old 03-15-2012, 09:29 PM   #6
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,359

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
If its any help, this http://linux.die.net/man/1/bash has read -s documented
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
"short read (fsck)" on disc access (failed command: READ FPDMA QUEUED) estellnb Linux - Hardware 3 02-22-2012 05:27 PM
gdb/Core Dump: "warning: Can't read pathname for load map: Input/output error." pr_deltoid Programming 2 07-03-2010 12:04 PM
Wanted to install "unsupported" Amaya editor but it doesn't show in menus... crgrove Ubuntu 1 03-03-2009 05:16 PM
"mplayer -input file=myfile" doesn't work. lumix Linux - Software 1 04-28-2008 04:05 AM
Make "ls" command show colors without "--color=always" switch SharpyWarpy Linux - General 4 07-16-2007 11:00 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Security

All times are GMT -5. The time now is 05:52 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration