LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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 10-23-2008, 07:57 AM   #1
tatanna
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/

Code:
#!/bin/sh
NAME=mount_raid
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
  start)
	mount_raid
	;;
  stop)
	umount_raid
	;;
  *)
	N=/etc/init.d/$NAME
	# echo "Usage: $N {start|stop}" >&2
	echo "Usage: $N {start|stop}" >&2
	exit 1
	;;
esac

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?

thanks
 
Old 10-24-2008, 09:47 PM   #2
plpl303
Member
 
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:

Code:
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, 07:15 PM   #3
tatanna
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

Code:
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, 06:03 AM   #4
tatanna
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!
 
  


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


All times are GMT -5. The time now is 03:02 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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration