LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
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, 10:42 AM   #1
TITiAN
Member
 
Registered: Mar 2008
Location: NRW, Germany
Distribution: Debian GNU/Linux with XFCE and packages from "testing"
Posts: 377

Rep: Reputation: 46
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, 10:45 AM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,415

Rep: Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968
"man read" says use the -s flag.
 
Old 03-07-2012, 11:14 AM   #3
TITiAN
Member
 
Registered: Mar 2008
Location: NRW, Germany
Distribution: Debian GNU/Linux with XFCE and packages from "testing"
Posts: 377

Original Poster
Rep: Reputation: 46
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, 11:17 AM   #4
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,415

Rep: Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968Reputation: 1968
heh. ok... MY "man read" says....
 
Old 03-07-2012, 12:57 PM   #5
TITiAN
Member
 
Registered: Mar 2008
Location: NRW, Germany
Distribution: Debian GNU/Linux with XFCE and packages from "testing"
Posts: 377

Original Poster
Rep: Reputation: 46
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, 10:29 PM   #6
chrism01
Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Centos 6.6, Centos 5.10
Posts: 16,324

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


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 06:27 PM
gdb/Core Dump: "warning: Can't read pathname for load map: Input/output error." pr_deltoid Programming 2 07-03-2010 01:04 PM
Wanted to install "unsupported" Amaya editor but it doesn't show in menus... crgrove Ubuntu 1 03-03-2009 06:16 PM
"mplayer -input file=myfile" doesn't work. lumix Linux - Software 1 04-28-2008 05:05 AM
Make "ls" command show colors without "--color=always" switch SharpyWarpy Linux - General 4 07-17-2007 12:00 AM


All times are GMT -5. The time now is 05:27 PM.

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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration