LinuxQuestions.org
Did you know LQ has a Linux Hardware Compatibility List?
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices



Reply
 
Search this Thread
Old 09-10-2007, 09:09 AM   #1
kaplan71
Member
 
Registered: Nov 2003
Posts: 719

Rep: Reputation: 39
Prompting a user for a password within a script


Hi there --

I am writing a script that will provide a telnet connection to a remote server. What I need to do is have the user prompted for his/her password during the execution of the script. The shell that I am using is bash, and the OS is Fedora Core 2. What syntax would I user to accomplish this? Thanks.
 
Old 09-10-2007, 09:28 AM   #2
theYinYeti
Senior Member
 
Registered: Jul 2004
Location: France
Distribution: Arch Linux
Posts: 1,897

Rep: Reputation: 61
You may want to look into the "expect" command, or maybe more simply the "read" builtin command from bash.

Yves.
 
Old 09-10-2007, 09:51 AM   #3
kaplan71
Member
 
Registered: Nov 2003
Posts: 719

Original Poster
Rep: Reputation: 39
Hi there --

Thanks for your reply. I checked the system in question for expect, and it is not installed. I could go through the motions of installing it, but before I do, I would like to see if read would work in this scenario.

What syntax would I use for read in order to have the user prompted for a username and password once the telnet session is initiated? Thanks.
 
Old 09-10-2007, 02:32 PM   #4
kromberg
Member
 
Registered: Feb 2007
Location: Colorado
Distribution: FC6, FC7 x86_64
Posts: 218

Rep: Reputation: 30
Code:
echo -n "Enter password > "
password=""

# the -s option will not echo the typed characters.
read -s password
Keith
 
Old 09-10-2007, 02:38 PM   #5
kaplan71
Member
 
Registered: Nov 2003
Posts: 719

Original Poster
Rep: Reputation: 39
Hi there --

Thanks for your reply. I'll try the script with your entries, and let post the results. Thanks for the help.
 
  


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
SWAT is prompting for a username/password jdklein1975 Linux - Newbie 2 07-23-2008 06:08 PM
pam_wheel still started prompting for su password again sixerjman Linux - Software 0 09-20-2006 01:04 PM
Ssh without prompting for a password deqmacrom Linux - General 2 04-21-2005 03:13 AM
Prompting for a password with pppoe fcnewbie Mandriva 0 06-15-2004 02:36 PM
frequent password prompting jwhiz Linux - Newbie 3 12-27-2003 06:03 PM


All times are GMT -5. The time now is 09:28 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