LinuxQuestions.org
Share your knowledge at the LQ Wiki.
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, 08:09 AM   #1
kaplan71
Member
 
Registered: Nov 2003
Posts: 809

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, 08:28 AM   #2
theYinYeti
Senior Member
 
Registered: Jul 2004
Location: France
Distribution: Arch Linux
Posts: 1,897

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

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

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, 01: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, 01:38 PM   #5
kaplan71
Member
 
Registered: Nov 2003
Posts: 809

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

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 05:58 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
Open Source Consulting | Domain Registration