- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Entering passwords
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-29-2002 10:46 AM
07-29-2002 10:46 AM
I need to prompt the users for passwords without anyone being able to see it? Is there an easy way to do this in a shell script?
TIA, Derek
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-29-2002 10:48 AM
07-29-2002 10:48 AM
SolutionYes, it's quite easy.
#!/usr/bin/sh
trap 'stty echo; exit' 0 1 2 3 15
echo "Enter Password: \c"
stty -echo
read PASSWD
stty echo
I should add that the trap command is really not optional. You see, the stty command alters the tty device, not just your script. Any subsequent processes would also have the echo turned off if you exited in the -echo state. The trap, insures that the terminal is restored upon exit even via a Ctrl-C (or whatever your n'rupt is set to).
I suggest that you comment out the trap statement and do a ctrl-c when entering the password and you will see just what I mean.
Regards, Clay
P.S. You should have been able to find this yourself with that little
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-29-2002 11:15 AM
07-29-2002 11:15 AM
Re: Entering passwords
TIA, Derek
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-29-2002 11:18 AM
07-29-2002 11:18 AM
Re: Entering passwords
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-29-2002 02:06 PM
07-29-2002 02:06 PM
Re: Entering passwords
I have one last related question. Is there a way in unix to clear the screen? to place the cursor at a certain location? I know I need to echo some kind of character sequence.
TIA, Derek
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-29-2002 02:09 PM
07-29-2002 02:09 PM
Re: Entering passwords
e.g.
tput cup row column
positions the cursor.
tput clear
clears the screen.
Tput looks up these sequences in the terminfo database and instantiates them if the sequence is defined.
Man tput and terminfo for details.
Clay