Help answer threads with 0 replies.
Go Back > Forums > Linux Forums > Linux - Security
User Name
Linux - Security This forum is for all security related questions.
Questions, tips, system compromises, firewalls, etc. are all included here.


  Search this Thread
Old 10-23-2008, 06:57 AM   #1
LQ Newbie
Registered: Oct 2008
Posts: 9

Rep: Reputation: 0
disable echoing password in etc/init.d encryption boot script

Hello I have this working script in /etc/init.d/

DESC="Mount RAID encrypted volume"

mount_raid() {
	echo "Unlocking /dev/md0"
	stty -echo
	cryptsetup luksOpen /dev/md0 raid_data
	stty echo
	echo "Scanning for volume groups"
	vgscan --mknodes
	vgchange -ay
	echo "Mounting /media/raid_data/"
	mount /dev/mapper/raid_data_vol-raid_data /media/raid_data/

umount_raid() {
	echo "Un-mounting /media/raid_data/"
	umount /media/raid_data/
	# Mark the logical volume INACTIVE (can be restored with 'lvchange -ay')
	lvchange -an raid_data_vol
	# Mark the volume group INACTIVE (can be restored with 'vgchange -ay')
	vgchange -an raid_data_vol
	echo "Re-locking /dev/md0"
	cryptsetup remove raid_data

case "$1" in
	# echo "Usage: $N {start|stop}" >&2
	echo "Usage: $N {start|stop}" >&2
	exit 1

exit 0
How do I disable echoing of the password when I input it during the boot process?

as you can see I tried with the option "stty -echo" but doesn't seem to work.. any idea?

Old 10-24-2008, 08:47 PM   #2
Registered: Oct 2008
Posts: 31

Rep: Reputation: 15
I've never worked with cryptsetup -- but I'm surprised it echoes the passphrase.

Maybe something like this will do what you want:

read -s -p "Enter password: " mypass
echo $mypass | cryptsetup luksOpen /dev/md0 raid_data

I haven't tried it, but just from eyeballing, it looks like it should (might ;-) work.
Old 10-25-2008, 06:15 PM   #3
LQ Newbie
Registered: Oct 2008
Posts: 9

Original Poster
Rep: Reputation: 0
Hey thanks, the option -s wasn't supported in my bash shell.
However you prompted me the right way... below is what finally worked

stty -echo
read  -p "Enter password: " mypass
stty echo
echo $mypass | cryptsetup luksOpen /dev/md0 raid_data
thank you veyr much
Old 11-13-2008, 05:03 AM   #4
LQ Newbie
Registered: Oct 2008
Posts: 9

Original Poster
Rep: Reputation: 0
counter-order.. the above works in a shell but not during boot up!
what's the difference in the echoing between boot up scripts and userspace shell scripts??
why does it work only in the second??? really can't help myself!


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
Disable IPTABLES init script the_new_z Linux - Newbie 7 07-09-2008 11:47 AM
How i can disable boot-loader password linuxjamil Linux - Hardware 2 02-27-2008 02:33 PM
Linux password encryption and data encryption Tux-Slack Programming 4 06-20-2007 06:46 AM
Disable GUI boot on Init 5 rickylim Linux - Enterprise 4 05-30-2006 02:01 PM
disable "shutting down eth0" from init-script? tyrann Linux - General 3 07-13-2003 12:00 PM > Forums > Linux Forums > Linux - Security

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

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