- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- 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
02-18-2002 02:14 PM
02-18-2002 02:14 PM
Is there a way to enter a password from within a shell script and not have it echoed to the screen?
Thank you, Neil
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-18-2002 02:16 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-18-2002 02:17 PM
02-18-2002 02:17 PM
Re: Passwords
http://hpux.ee.ualberta.ca/hppd/hpux/Tcl/expect-5.33/
GL,
C
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-18-2002 02:19 PM
02-18-2002 02:19 PM
Re: Passwords
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, insure 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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-18-2002 11:00 PM
02-18-2002 11:00 PM
Re: Passwords
there is another command which I use very often in shell scripts:
tput --> a command which can be used to take influence on the behaviour of your cursor (and more)
man tput will show you the possibilities of the command. You will find a "invisible"- button which makes the entered textstring invisible at the screen, after reading the input you make the input visible again -- that's it!
Allways stay on the bright side of life!
Peter
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-18-2002 11:06 PM
02-18-2002 11:06 PM
Re: Passwords
I think I have found the elegant solution you wanted:
Execute this:
# ps -fp `echo $$`
$ ksh
$ ps -fp `echo $$`
UID PID PPID C STIME TTY TIME COMMAND
user1 16088 16079 0 15:01:49 pts/0 0:00 ksh
$ csh
sys 21: ps -fp `echo $$`
UID PID PPID C STIME TTY TIME COMMAND
user1 16334 16088 0 15:06:28 pts/0 0:00 csh
kite 22: sh
$ ps -fp `echo $$`
UID PID PPID C STIME TTY TIME COMMAND
user1 16345 16334 0 15:06:40 pts/0 0:00 sh
Hope this helps. Regards.
Steven Sim Kok Leong
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-18-2002 11:12 PM
02-18-2002 11:12 PM
Re: Passwords
Eh what happened?!
I was responding to another thread and my response ended up in this thread instead. :{
In any case, I agree with Clay that stty -echo and stty echo does the job nicely for "invisible" passwords. I used the following in one of my scripts:
echo "Enter passwd: \c"
trap "" 1 2 3
stty -echo
read passwd
stty echo
trap 1 2 3
Hope this helps. Regards.
Steven Sim Kok Leong